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

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.ProvisionedThroughputOverride
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the properties of a replica global secondary index.
--
-- /See:/ 'newReplicaGlobalSecondaryIndexDescription' smart constructor.
data ReplicaGlobalSecondaryIndexDescription = ReplicaGlobalSecondaryIndexDescription'
  { -- | If not described, uses the source table GSI\'s read capacity settings.
    ReplicaGlobalSecondaryIndexDescription
-> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride :: Prelude.Maybe ProvisionedThroughputOverride,
    -- | The name of the global secondary index.
    ReplicaGlobalSecondaryIndexDescription -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplicaGlobalSecondaryIndexDescription
-> ReplicaGlobalSecondaryIndexDescription -> Bool
(ReplicaGlobalSecondaryIndexDescription
 -> ReplicaGlobalSecondaryIndexDescription -> Bool)
-> (ReplicaGlobalSecondaryIndexDescription
    -> ReplicaGlobalSecondaryIndexDescription -> Bool)
-> Eq ReplicaGlobalSecondaryIndexDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaGlobalSecondaryIndexDescription
-> ReplicaGlobalSecondaryIndexDescription -> Bool
$c/= :: ReplicaGlobalSecondaryIndexDescription
-> ReplicaGlobalSecondaryIndexDescription -> Bool
== :: ReplicaGlobalSecondaryIndexDescription
-> ReplicaGlobalSecondaryIndexDescription -> Bool
$c== :: ReplicaGlobalSecondaryIndexDescription
-> ReplicaGlobalSecondaryIndexDescription -> Bool
Prelude.Eq, ReadPrec [ReplicaGlobalSecondaryIndexDescription]
ReadPrec ReplicaGlobalSecondaryIndexDescription
Int -> ReadS ReplicaGlobalSecondaryIndexDescription
ReadS [ReplicaGlobalSecondaryIndexDescription]
(Int -> ReadS ReplicaGlobalSecondaryIndexDescription)
-> ReadS [ReplicaGlobalSecondaryIndexDescription]
-> ReadPrec ReplicaGlobalSecondaryIndexDescription
-> ReadPrec [ReplicaGlobalSecondaryIndexDescription]
-> Read ReplicaGlobalSecondaryIndexDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaGlobalSecondaryIndexDescription]
$creadListPrec :: ReadPrec [ReplicaGlobalSecondaryIndexDescription]
readPrec :: ReadPrec ReplicaGlobalSecondaryIndexDescription
$creadPrec :: ReadPrec ReplicaGlobalSecondaryIndexDescription
readList :: ReadS [ReplicaGlobalSecondaryIndexDescription]
$creadList :: ReadS [ReplicaGlobalSecondaryIndexDescription]
readsPrec :: Int -> ReadS ReplicaGlobalSecondaryIndexDescription
$creadsPrec :: Int -> ReadS ReplicaGlobalSecondaryIndexDescription
Prelude.Read, Int -> ReplicaGlobalSecondaryIndexDescription -> ShowS
[ReplicaGlobalSecondaryIndexDescription] -> ShowS
ReplicaGlobalSecondaryIndexDescription -> String
(Int -> ReplicaGlobalSecondaryIndexDescription -> ShowS)
-> (ReplicaGlobalSecondaryIndexDescription -> String)
-> ([ReplicaGlobalSecondaryIndexDescription] -> ShowS)
-> Show ReplicaGlobalSecondaryIndexDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaGlobalSecondaryIndexDescription] -> ShowS
$cshowList :: [ReplicaGlobalSecondaryIndexDescription] -> ShowS
show :: ReplicaGlobalSecondaryIndexDescription -> String
$cshow :: ReplicaGlobalSecondaryIndexDescription -> String
showsPrec :: Int -> ReplicaGlobalSecondaryIndexDescription -> ShowS
$cshowsPrec :: Int -> ReplicaGlobalSecondaryIndexDescription -> ShowS
Prelude.Show, (forall x.
 ReplicaGlobalSecondaryIndexDescription
 -> Rep ReplicaGlobalSecondaryIndexDescription x)
-> (forall x.
    Rep ReplicaGlobalSecondaryIndexDescription x
    -> ReplicaGlobalSecondaryIndexDescription)
-> Generic ReplicaGlobalSecondaryIndexDescription
forall x.
Rep ReplicaGlobalSecondaryIndexDescription x
-> ReplicaGlobalSecondaryIndexDescription
forall x.
ReplicaGlobalSecondaryIndexDescription
-> Rep ReplicaGlobalSecondaryIndexDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicaGlobalSecondaryIndexDescription x
-> ReplicaGlobalSecondaryIndexDescription
$cfrom :: forall x.
ReplicaGlobalSecondaryIndexDescription
-> Rep ReplicaGlobalSecondaryIndexDescription x
Prelude.Generic)

-- |
-- Create a value of 'ReplicaGlobalSecondaryIndexDescription' 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:
--
-- 'provisionedThroughputOverride', 'replicaGlobalSecondaryIndexDescription_provisionedThroughputOverride' - If not described, uses the source table GSI\'s read capacity settings.
--
-- 'indexName', 'replicaGlobalSecondaryIndexDescription_indexName' - The name of the global secondary index.
newReplicaGlobalSecondaryIndexDescription ::
  ReplicaGlobalSecondaryIndexDescription
newReplicaGlobalSecondaryIndexDescription :: ReplicaGlobalSecondaryIndexDescription
newReplicaGlobalSecondaryIndexDescription =
  ReplicaGlobalSecondaryIndexDescription' :: Maybe ProvisionedThroughputOverride
-> Maybe Text -> ReplicaGlobalSecondaryIndexDescription
ReplicaGlobalSecondaryIndexDescription'
    { $sel:provisionedThroughputOverride:ReplicaGlobalSecondaryIndexDescription' :: Maybe ProvisionedThroughputOverride
provisionedThroughputOverride =
        Maybe ProvisionedThroughputOverride
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:ReplicaGlobalSecondaryIndexDescription' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If not described, uses the source table GSI\'s read capacity settings.
replicaGlobalSecondaryIndexDescription_provisionedThroughputOverride :: Lens.Lens' ReplicaGlobalSecondaryIndexDescription (Prelude.Maybe ProvisionedThroughputOverride)
replicaGlobalSecondaryIndexDescription_provisionedThroughputOverride :: (Maybe ProvisionedThroughputOverride
 -> f (Maybe ProvisionedThroughputOverride))
-> ReplicaGlobalSecondaryIndexDescription
-> f ReplicaGlobalSecondaryIndexDescription
replicaGlobalSecondaryIndexDescription_provisionedThroughputOverride = (ReplicaGlobalSecondaryIndexDescription
 -> Maybe ProvisionedThroughputOverride)
-> (ReplicaGlobalSecondaryIndexDescription
    -> Maybe ProvisionedThroughputOverride
    -> ReplicaGlobalSecondaryIndexDescription)
-> Lens
     ReplicaGlobalSecondaryIndexDescription
     ReplicaGlobalSecondaryIndexDescription
     (Maybe ProvisionedThroughputOverride)
     (Maybe ProvisionedThroughputOverride)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaGlobalSecondaryIndexDescription' {Maybe ProvisionedThroughputOverride
provisionedThroughputOverride :: Maybe ProvisionedThroughputOverride
$sel:provisionedThroughputOverride:ReplicaGlobalSecondaryIndexDescription' :: ReplicaGlobalSecondaryIndexDescription
-> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride} -> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride) (\s :: ReplicaGlobalSecondaryIndexDescription
s@ReplicaGlobalSecondaryIndexDescription' {} Maybe ProvisionedThroughputOverride
a -> ReplicaGlobalSecondaryIndexDescription
s {$sel:provisionedThroughputOverride:ReplicaGlobalSecondaryIndexDescription' :: Maybe ProvisionedThroughputOverride
provisionedThroughputOverride = Maybe ProvisionedThroughputOverride
a} :: ReplicaGlobalSecondaryIndexDescription)

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

instance
  Core.FromJSON
    ReplicaGlobalSecondaryIndexDescription
  where
  parseJSON :: Value -> Parser ReplicaGlobalSecondaryIndexDescription
parseJSON =
    String
-> (Object -> Parser ReplicaGlobalSecondaryIndexDescription)
-> Value
-> Parser ReplicaGlobalSecondaryIndexDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReplicaGlobalSecondaryIndexDescription"
      ( \Object
x ->
          Maybe ProvisionedThroughputOverride
-> Maybe Text -> ReplicaGlobalSecondaryIndexDescription
ReplicaGlobalSecondaryIndexDescription'
            (Maybe ProvisionedThroughputOverride
 -> Maybe Text -> ReplicaGlobalSecondaryIndexDescription)
-> Parser (Maybe ProvisionedThroughputOverride)
-> Parser (Maybe Text -> ReplicaGlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ProvisionedThroughputOverride)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProvisionedThroughputOverride")
            Parser (Maybe Text -> ReplicaGlobalSecondaryIndexDescription)
-> Parser (Maybe Text)
-> Parser ReplicaGlobalSecondaryIndexDescription
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
    ReplicaGlobalSecondaryIndexDescription

instance
  Prelude.NFData
    ReplicaGlobalSecondaryIndexDescription