{-# 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-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.GlobalSecondaryIndexAutoScalingUpdate 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
-- global table that will be modified.
--
-- /See:/ 'newGlobalSecondaryIndexAutoScalingUpdate' smart constructor.
data GlobalSecondaryIndexAutoScalingUpdate = GlobalSecondaryIndexAutoScalingUpdate'
  { GlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate :: Prelude.Maybe AutoScalingSettingsUpdate,
    -- | The name of the global secondary index.
    GlobalSecondaryIndexAutoScalingUpdate -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text
  }
  deriving (GlobalSecondaryIndexAutoScalingUpdate
-> GlobalSecondaryIndexAutoScalingUpdate -> Bool
(GlobalSecondaryIndexAutoScalingUpdate
 -> GlobalSecondaryIndexAutoScalingUpdate -> Bool)
-> (GlobalSecondaryIndexAutoScalingUpdate
    -> GlobalSecondaryIndexAutoScalingUpdate -> Bool)
-> Eq GlobalSecondaryIndexAutoScalingUpdate
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]
(Int -> ReadS GlobalSecondaryIndexAutoScalingUpdate)
-> ReadS [GlobalSecondaryIndexAutoScalingUpdate]
-> ReadPrec GlobalSecondaryIndexAutoScalingUpdate
-> ReadPrec [GlobalSecondaryIndexAutoScalingUpdate]
-> Read 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
(Int -> GlobalSecondaryIndexAutoScalingUpdate -> ShowS)
-> (GlobalSecondaryIndexAutoScalingUpdate -> String)
-> ([GlobalSecondaryIndexAutoScalingUpdate] -> ShowS)
-> Show GlobalSecondaryIndexAutoScalingUpdate
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.
 GlobalSecondaryIndexAutoScalingUpdate
 -> Rep GlobalSecondaryIndexAutoScalingUpdate x)
-> (forall x.
    Rep GlobalSecondaryIndexAutoScalingUpdate x
    -> GlobalSecondaryIndexAutoScalingUpdate)
-> Generic GlobalSecondaryIndexAutoScalingUpdate
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:
--
-- 'provisionedWriteCapacityAutoScalingUpdate', 'globalSecondaryIndexAutoScalingUpdate_provisionedWriteCapacityAutoScalingUpdate' - Undocumented member.
--
-- 'indexName', 'globalSecondaryIndexAutoScalingUpdate_indexName' - The name of the global secondary index.
newGlobalSecondaryIndexAutoScalingUpdate ::
  GlobalSecondaryIndexAutoScalingUpdate
newGlobalSecondaryIndexAutoScalingUpdate :: GlobalSecondaryIndexAutoScalingUpdate
newGlobalSecondaryIndexAutoScalingUpdate =
  GlobalSecondaryIndexAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
-> Maybe Text -> GlobalSecondaryIndexAutoScalingUpdate
GlobalSecondaryIndexAutoScalingUpdate'
    { $sel:provisionedWriteCapacityAutoScalingUpdate:GlobalSecondaryIndexAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
provisionedWriteCapacityAutoScalingUpdate =
        Maybe AutoScalingSettingsUpdate
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:GlobalSecondaryIndexAutoScalingUpdate' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance
  Prelude.Hashable
    GlobalSecondaryIndexAutoScalingUpdate

instance
  Prelude.NFData
    GlobalSecondaryIndexAutoScalingUpdate

instance
  Core.ToJSON
    GlobalSecondaryIndexAutoScalingUpdate
  where
  toJSON :: GlobalSecondaryIndexAutoScalingUpdate -> Value
toJSON GlobalSecondaryIndexAutoScalingUpdate' {Maybe Text
Maybe AutoScalingSettingsUpdate
indexName :: Maybe Text
provisionedWriteCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
$sel:indexName:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate -> Maybe Text
$sel:provisionedWriteCapacityAutoScalingUpdate:GlobalSecondaryIndexAutoScalingUpdate' :: GlobalSecondaryIndexAutoScalingUpdate
-> Maybe AutoScalingSettingsUpdate
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ ( Text
"ProvisionedWriteCapacityAutoScalingUpdate"
                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
provisionedWriteCapacityAutoScalingUpdate,
            (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
          ]
      )