{-# 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.ReplicaGlobalSecondaryIndexAutoScalingDescription
-- 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.ReplicaGlobalSecondaryIndexAutoScalingDescription where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.AutoScalingSettingsDescription
import Amazonka.DynamoDB.Types.IndexStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the auto scaling configuration for a replica global secondary
-- index.
--
-- /See:/ 'newReplicaGlobalSecondaryIndexAutoScalingDescription' smart constructor.
data ReplicaGlobalSecondaryIndexAutoScalingDescription = ReplicaGlobalSecondaryIndexAutoScalingDescription'
  { -- | The current state of the replica global secondary index:
    --
    -- -   @CREATING@ - The index is being created.
    --
    -- -   @UPDATING@ - The index is being updated.
    --
    -- -   @DELETING@ - The index is being deleted.
    --
    -- -   @ACTIVE@ - The index is ready for use.
    ReplicaGlobalSecondaryIndexAutoScalingDescription
-> Maybe IndexStatus
indexStatus :: Prelude.Maybe IndexStatus,
    ReplicaGlobalSecondaryIndexAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
provisionedWriteCapacityAutoScalingSettings :: Prelude.Maybe AutoScalingSettingsDescription,
    ReplicaGlobalSecondaryIndexAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
provisionedReadCapacityAutoScalingSettings :: Prelude.Maybe AutoScalingSettingsDescription,
    -- | The name of the global secondary index.
    ReplicaGlobalSecondaryIndexAutoScalingDescription -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplicaGlobalSecondaryIndexAutoScalingDescription
-> ReplicaGlobalSecondaryIndexAutoScalingDescription -> Bool
(ReplicaGlobalSecondaryIndexAutoScalingDescription
 -> ReplicaGlobalSecondaryIndexAutoScalingDescription -> Bool)
-> (ReplicaGlobalSecondaryIndexAutoScalingDescription
    -> ReplicaGlobalSecondaryIndexAutoScalingDescription -> Bool)
-> Eq ReplicaGlobalSecondaryIndexAutoScalingDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaGlobalSecondaryIndexAutoScalingDescription
-> ReplicaGlobalSecondaryIndexAutoScalingDescription -> Bool
$c/= :: ReplicaGlobalSecondaryIndexAutoScalingDescription
-> ReplicaGlobalSecondaryIndexAutoScalingDescription -> Bool
== :: ReplicaGlobalSecondaryIndexAutoScalingDescription
-> ReplicaGlobalSecondaryIndexAutoScalingDescription -> Bool
$c== :: ReplicaGlobalSecondaryIndexAutoScalingDescription
-> ReplicaGlobalSecondaryIndexAutoScalingDescription -> Bool
Prelude.Eq, ReadPrec [ReplicaGlobalSecondaryIndexAutoScalingDescription]
ReadPrec ReplicaGlobalSecondaryIndexAutoScalingDescription
Int -> ReadS ReplicaGlobalSecondaryIndexAutoScalingDescription
ReadS [ReplicaGlobalSecondaryIndexAutoScalingDescription]
(Int -> ReadS ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> ReadS [ReplicaGlobalSecondaryIndexAutoScalingDescription]
-> ReadPrec ReplicaGlobalSecondaryIndexAutoScalingDescription
-> ReadPrec [ReplicaGlobalSecondaryIndexAutoScalingDescription]
-> Read ReplicaGlobalSecondaryIndexAutoScalingDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaGlobalSecondaryIndexAutoScalingDescription]
$creadListPrec :: ReadPrec [ReplicaGlobalSecondaryIndexAutoScalingDescription]
readPrec :: ReadPrec ReplicaGlobalSecondaryIndexAutoScalingDescription
$creadPrec :: ReadPrec ReplicaGlobalSecondaryIndexAutoScalingDescription
readList :: ReadS [ReplicaGlobalSecondaryIndexAutoScalingDescription]
$creadList :: ReadS [ReplicaGlobalSecondaryIndexAutoScalingDescription]
readsPrec :: Int -> ReadS ReplicaGlobalSecondaryIndexAutoScalingDescription
$creadsPrec :: Int -> ReadS ReplicaGlobalSecondaryIndexAutoScalingDescription
Prelude.Read, Int -> ReplicaGlobalSecondaryIndexAutoScalingDescription -> ShowS
[ReplicaGlobalSecondaryIndexAutoScalingDescription] -> ShowS
ReplicaGlobalSecondaryIndexAutoScalingDescription -> String
(Int -> ReplicaGlobalSecondaryIndexAutoScalingDescription -> ShowS)
-> (ReplicaGlobalSecondaryIndexAutoScalingDescription -> String)
-> ([ReplicaGlobalSecondaryIndexAutoScalingDescription] -> ShowS)
-> Show ReplicaGlobalSecondaryIndexAutoScalingDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaGlobalSecondaryIndexAutoScalingDescription] -> ShowS
$cshowList :: [ReplicaGlobalSecondaryIndexAutoScalingDescription] -> ShowS
show :: ReplicaGlobalSecondaryIndexAutoScalingDescription -> String
$cshow :: ReplicaGlobalSecondaryIndexAutoScalingDescription -> String
showsPrec :: Int -> ReplicaGlobalSecondaryIndexAutoScalingDescription -> ShowS
$cshowsPrec :: Int -> ReplicaGlobalSecondaryIndexAutoScalingDescription -> ShowS
Prelude.Show, (forall x.
 ReplicaGlobalSecondaryIndexAutoScalingDescription
 -> Rep ReplicaGlobalSecondaryIndexAutoScalingDescription x)
-> (forall x.
    Rep ReplicaGlobalSecondaryIndexAutoScalingDescription x
    -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Generic ReplicaGlobalSecondaryIndexAutoScalingDescription
forall x.
Rep ReplicaGlobalSecondaryIndexAutoScalingDescription x
-> ReplicaGlobalSecondaryIndexAutoScalingDescription
forall x.
ReplicaGlobalSecondaryIndexAutoScalingDescription
-> Rep ReplicaGlobalSecondaryIndexAutoScalingDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicaGlobalSecondaryIndexAutoScalingDescription x
-> ReplicaGlobalSecondaryIndexAutoScalingDescription
$cfrom :: forall x.
ReplicaGlobalSecondaryIndexAutoScalingDescription
-> Rep ReplicaGlobalSecondaryIndexAutoScalingDescription x
Prelude.Generic)

-- |
-- Create a value of 'ReplicaGlobalSecondaryIndexAutoScalingDescription' 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:
--
-- 'indexStatus', 'replicaGlobalSecondaryIndexAutoScalingDescription_indexStatus' - The current state of the replica global secondary index:
--
-- -   @CREATING@ - The index is being created.
--
-- -   @UPDATING@ - The index is being updated.
--
-- -   @DELETING@ - The index is being deleted.
--
-- -   @ACTIVE@ - The index is ready for use.
--
-- 'provisionedWriteCapacityAutoScalingSettings', 'replicaGlobalSecondaryIndexAutoScalingDescription_provisionedWriteCapacityAutoScalingSettings' - Undocumented member.
--
-- 'provisionedReadCapacityAutoScalingSettings', 'replicaGlobalSecondaryIndexAutoScalingDescription_provisionedReadCapacityAutoScalingSettings' - Undocumented member.
--
-- 'indexName', 'replicaGlobalSecondaryIndexAutoScalingDescription_indexName' - The name of the global secondary index.
newReplicaGlobalSecondaryIndexAutoScalingDescription ::
  ReplicaGlobalSecondaryIndexAutoScalingDescription
newReplicaGlobalSecondaryIndexAutoScalingDescription :: ReplicaGlobalSecondaryIndexAutoScalingDescription
newReplicaGlobalSecondaryIndexAutoScalingDescription =
  ReplicaGlobalSecondaryIndexAutoScalingDescription' :: Maybe IndexStatus
-> Maybe AutoScalingSettingsDescription
-> Maybe AutoScalingSettingsDescription
-> Maybe Text
-> ReplicaGlobalSecondaryIndexAutoScalingDescription
ReplicaGlobalSecondaryIndexAutoScalingDescription'
    { $sel:indexStatus:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: Maybe IndexStatus
indexStatus =
        Maybe IndexStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedWriteCapacityAutoScalingSettings:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: Maybe AutoScalingSettingsDescription
provisionedWriteCapacityAutoScalingSettings =
        Maybe AutoScalingSettingsDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedReadCapacityAutoScalingSettings:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: Maybe AutoScalingSettingsDescription
provisionedReadCapacityAutoScalingSettings =
        Maybe AutoScalingSettingsDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: Maybe Text
indexName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the replica global secondary index:
--
-- -   @CREATING@ - The index is being created.
--
-- -   @UPDATING@ - The index is being updated.
--
-- -   @DELETING@ - The index is being deleted.
--
-- -   @ACTIVE@ - The index is ready for use.
replicaGlobalSecondaryIndexAutoScalingDescription_indexStatus :: Lens.Lens' ReplicaGlobalSecondaryIndexAutoScalingDescription (Prelude.Maybe IndexStatus)
replicaGlobalSecondaryIndexAutoScalingDescription_indexStatus :: (Maybe IndexStatus -> f (Maybe IndexStatus))
-> ReplicaGlobalSecondaryIndexAutoScalingDescription
-> f ReplicaGlobalSecondaryIndexAutoScalingDescription
replicaGlobalSecondaryIndexAutoScalingDescription_indexStatus = (ReplicaGlobalSecondaryIndexAutoScalingDescription
 -> Maybe IndexStatus)
-> (ReplicaGlobalSecondaryIndexAutoScalingDescription
    -> Maybe IndexStatus
    -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Lens
     ReplicaGlobalSecondaryIndexAutoScalingDescription
     ReplicaGlobalSecondaryIndexAutoScalingDescription
     (Maybe IndexStatus)
     (Maybe IndexStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexAutoScalingDescription' {Maybe IndexStatus
indexStatus :: Maybe IndexStatus
$sel:indexStatus:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: ReplicaGlobalSecondaryIndexAutoScalingDescription
-> Maybe IndexStatus
indexStatus} -> Maybe IndexStatus
indexStatus) (\s :: ReplicaGlobalSecondaryIndexAutoScalingDescription
s@ReplicaGlobalSecondaryIndexAutoScalingDescription' {} Maybe IndexStatus
a -> ReplicaGlobalSecondaryIndexAutoScalingDescription
s {$sel:indexStatus:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: Maybe IndexStatus
indexStatus = Maybe IndexStatus
a} :: ReplicaGlobalSecondaryIndexAutoScalingDescription)

-- | Undocumented member.
replicaGlobalSecondaryIndexAutoScalingDescription_provisionedWriteCapacityAutoScalingSettings :: Lens.Lens' ReplicaGlobalSecondaryIndexAutoScalingDescription (Prelude.Maybe AutoScalingSettingsDescription)
replicaGlobalSecondaryIndexAutoScalingDescription_provisionedWriteCapacityAutoScalingSettings :: (Maybe AutoScalingSettingsDescription
 -> f (Maybe AutoScalingSettingsDescription))
-> ReplicaGlobalSecondaryIndexAutoScalingDescription
-> f ReplicaGlobalSecondaryIndexAutoScalingDescription
replicaGlobalSecondaryIndexAutoScalingDescription_provisionedWriteCapacityAutoScalingSettings = (ReplicaGlobalSecondaryIndexAutoScalingDescription
 -> Maybe AutoScalingSettingsDescription)
-> (ReplicaGlobalSecondaryIndexAutoScalingDescription
    -> Maybe AutoScalingSettingsDescription
    -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Lens
     ReplicaGlobalSecondaryIndexAutoScalingDescription
     ReplicaGlobalSecondaryIndexAutoScalingDescription
     (Maybe AutoScalingSettingsDescription)
     (Maybe AutoScalingSettingsDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexAutoScalingDescription' {Maybe AutoScalingSettingsDescription
provisionedWriteCapacityAutoScalingSettings :: Maybe AutoScalingSettingsDescription
$sel:provisionedWriteCapacityAutoScalingSettings:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: ReplicaGlobalSecondaryIndexAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
provisionedWriteCapacityAutoScalingSettings} -> Maybe AutoScalingSettingsDescription
provisionedWriteCapacityAutoScalingSettings) (\s :: ReplicaGlobalSecondaryIndexAutoScalingDescription
s@ReplicaGlobalSecondaryIndexAutoScalingDescription' {} Maybe AutoScalingSettingsDescription
a -> ReplicaGlobalSecondaryIndexAutoScalingDescription
s {$sel:provisionedWriteCapacityAutoScalingSettings:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: Maybe AutoScalingSettingsDescription
provisionedWriteCapacityAutoScalingSettings = Maybe AutoScalingSettingsDescription
a} :: ReplicaGlobalSecondaryIndexAutoScalingDescription)

-- | Undocumented member.
replicaGlobalSecondaryIndexAutoScalingDescription_provisionedReadCapacityAutoScalingSettings :: Lens.Lens' ReplicaGlobalSecondaryIndexAutoScalingDescription (Prelude.Maybe AutoScalingSettingsDescription)
replicaGlobalSecondaryIndexAutoScalingDescription_provisionedReadCapacityAutoScalingSettings :: (Maybe AutoScalingSettingsDescription
 -> f (Maybe AutoScalingSettingsDescription))
-> ReplicaGlobalSecondaryIndexAutoScalingDescription
-> f ReplicaGlobalSecondaryIndexAutoScalingDescription
replicaGlobalSecondaryIndexAutoScalingDescription_provisionedReadCapacityAutoScalingSettings = (ReplicaGlobalSecondaryIndexAutoScalingDescription
 -> Maybe AutoScalingSettingsDescription)
-> (ReplicaGlobalSecondaryIndexAutoScalingDescription
    -> Maybe AutoScalingSettingsDescription
    -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Lens
     ReplicaGlobalSecondaryIndexAutoScalingDescription
     ReplicaGlobalSecondaryIndexAutoScalingDescription
     (Maybe AutoScalingSettingsDescription)
     (Maybe AutoScalingSettingsDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexAutoScalingDescription' {Maybe AutoScalingSettingsDescription
provisionedReadCapacityAutoScalingSettings :: Maybe AutoScalingSettingsDescription
$sel:provisionedReadCapacityAutoScalingSettings:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: ReplicaGlobalSecondaryIndexAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
provisionedReadCapacityAutoScalingSettings} -> Maybe AutoScalingSettingsDescription
provisionedReadCapacityAutoScalingSettings) (\s :: ReplicaGlobalSecondaryIndexAutoScalingDescription
s@ReplicaGlobalSecondaryIndexAutoScalingDescription' {} Maybe AutoScalingSettingsDescription
a -> ReplicaGlobalSecondaryIndexAutoScalingDescription
s {$sel:provisionedReadCapacityAutoScalingSettings:ReplicaGlobalSecondaryIndexAutoScalingDescription' :: Maybe AutoScalingSettingsDescription
provisionedReadCapacityAutoScalingSettings = Maybe AutoScalingSettingsDescription
a} :: ReplicaGlobalSecondaryIndexAutoScalingDescription)

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

instance
  Core.FromJSON
    ReplicaGlobalSecondaryIndexAutoScalingDescription
  where
  parseJSON :: Value -> Parser ReplicaGlobalSecondaryIndexAutoScalingDescription
parseJSON =
    String
-> (Object
    -> Parser ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Value
-> Parser ReplicaGlobalSecondaryIndexAutoScalingDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReplicaGlobalSecondaryIndexAutoScalingDescription"
      ( \Object
x ->
          Maybe IndexStatus
-> Maybe AutoScalingSettingsDescription
-> Maybe AutoScalingSettingsDescription
-> Maybe Text
-> ReplicaGlobalSecondaryIndexAutoScalingDescription
ReplicaGlobalSecondaryIndexAutoScalingDescription'
            (Maybe IndexStatus
 -> Maybe AutoScalingSettingsDescription
 -> Maybe AutoScalingSettingsDescription
 -> Maybe Text
 -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Parser (Maybe IndexStatus)
-> Parser
     (Maybe AutoScalingSettingsDescription
      -> Maybe AutoScalingSettingsDescription
      -> Maybe Text
      -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe IndexStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexStatus")
              Parser
  (Maybe AutoScalingSettingsDescription
   -> Maybe AutoScalingSettingsDescription
   -> Maybe Text
   -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Parser (Maybe AutoScalingSettingsDescription)
-> Parser
     (Maybe AutoScalingSettingsDescription
      -> Maybe Text -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                              Object -> Text -> Parser (Maybe AutoScalingSettingsDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProvisionedWriteCapacityAutoScalingSettings"
                          )
              Parser
  (Maybe AutoScalingSettingsDescription
   -> Maybe Text -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Parser (Maybe AutoScalingSettingsDescription)
-> Parser
     (Maybe Text -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                              Object -> Text -> Parser (Maybe AutoScalingSettingsDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProvisionedReadCapacityAutoScalingSettings"
                          )
              Parser
  (Maybe Text -> ReplicaGlobalSecondaryIndexAutoScalingDescription)
-> Parser (Maybe Text)
-> Parser ReplicaGlobalSecondaryIndexAutoScalingDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexName")
      )

instance
  Prelude.Hashable
    ReplicaGlobalSecondaryIndexAutoScalingDescription

instance
  Prelude.NFData
    ReplicaGlobalSecondaryIndexAutoScalingDescription