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

-- |
-- Create a value of 'GlobalSecondaryIndexAutoScalingUpdate' 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', 'globalSecondaryIndexAutoScalingUpdate_indexName' - The name of the global secondary index.
--
-- 'provisionedWriteCapacityAutoScalingUpdate', 'globalSecondaryIndexAutoScalingUpdate_provisionedWriteCapacityAutoScalingUpdate' - Undocumented member.
newGlobalSecondaryIndexAutoScalingUpdate ::
  GlobalSecondaryIndexAutoScalingUpdate
newGlobalSecondaryIndexAutoScalingUpdate :: GlobalSecondaryIndexAutoScalingUpdate
newGlobalSecondaryIndexAutoScalingUpdate =
  GlobalSecondaryIndexAutoScalingUpdate'
    { $sel:indexName:GlobalSecondaryIndexAutoScalingUpdate' :: Maybe Text
indexName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedWriteCapacityAutoScalingUpdate:GlobalSecondaryIndexAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate =
        forall a. Maybe a
Prelude.Nothing
    }

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

-- | Undocumented member.
globalSecondaryIndexAutoScalingUpdate_provisionedWriteCapacityAutoScalingUpdate :: Lens.Lens' GlobalSecondaryIndexAutoScalingUpdate (Prelude.Maybe AutoScalingSettingsUpdate)
globalSecondaryIndexAutoScalingUpdate_provisionedWriteCapacityAutoScalingUpdate :: Lens'
  GlobalSecondaryIndexAutoScalingUpdate
  (Maybe AutoScalingSettingsUpdate)
globalSecondaryIndexAutoScalingUpdate_provisionedWriteCapacityAutoScalingUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexAutoScalingUpdate' {Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
$sel:provisionedWriteCapacityAutoScalingUpdate:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate} -> Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate) (\s :: GlobalSecondaryIndexAutoScalingUpdate
s@GlobalSecondaryIndexAutoScalingUpdate' {} Maybe AutoScalingSettingsUpdate
a -> GlobalSecondaryIndexAutoScalingUpdate
s {$sel:provisionedWriteCapacityAutoScalingUpdate:GlobalSecondaryIndexAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate = Maybe AutoScalingSettingsUpdate
a} :: GlobalSecondaryIndexAutoScalingUpdate)

instance
  Prelude.Hashable
    GlobalSecondaryIndexAutoScalingUpdate
  where
  hashWithSalt :: Int -> GlobalSecondaryIndexAutoScalingUpdate -> Int
hashWithSalt
    Int
_salt
    GlobalSecondaryIndexAutoScalingUpdate' {Maybe Text
Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
indexName :: Maybe Text
$sel:provisionedWriteCapacityAutoScalingUpdate:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
$sel:indexName:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate -> 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
provisionedWriteCapacityAutoScalingUpdate

instance
  Prelude.NFData
    GlobalSecondaryIndexAutoScalingUpdate
  where
  rnf :: GlobalSecondaryIndexAutoScalingUpdate -> ()
rnf GlobalSecondaryIndexAutoScalingUpdate' {Maybe Text
Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
indexName :: Maybe Text
$sel:provisionedWriteCapacityAutoScalingUpdate:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
$sel:indexName:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate -> 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
provisionedWriteCapacityAutoScalingUpdate

instance
  Data.ToJSON
    GlobalSecondaryIndexAutoScalingUpdate
  where
  toJSON :: GlobalSecondaryIndexAutoScalingUpdate -> Value
toJSON GlobalSecondaryIndexAutoScalingUpdate' {Maybe Text
Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
indexName :: Maybe Text
$sel:provisionedWriteCapacityAutoScalingUpdate:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
$sel:indexName:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate -> 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
"ProvisionedWriteCapacityAutoScalingUpdate" 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
provisionedWriteCapacityAutoScalingUpdate
          ]
      )