{-# 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-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.ReplicaGlobalSecondaryIndexDescription 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.ProvisionedThroughputOverride
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Represents the properties of a replica global secondary index.
--
-- /See:/ 'newReplicaGlobalSecondaryIndexDescription' smart constructor.
data ReplicaGlobalSecondaryIndexDescription = ReplicaGlobalSecondaryIndexDescription'
  { -- | The name of the global secondary index.
    ReplicaGlobalSecondaryIndexDescription -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
    -- | If not described, uses the source table GSI\'s read capacity settings.
    ReplicaGlobalSecondaryIndexDescription
-> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride :: Prelude.Maybe ProvisionedThroughputOverride
  }
  deriving (ReplicaGlobalSecondaryIndexDescription
-> ReplicaGlobalSecondaryIndexDescription -> Bool
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]
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
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.
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:
--
-- 'indexName', 'replicaGlobalSecondaryIndexDescription_indexName' - The name of the global secondary index.
--
-- 'provisionedThroughputOverride', 'replicaGlobalSecondaryIndexDescription_provisionedThroughputOverride' - If not described, uses the source table GSI\'s read capacity settings.
newReplicaGlobalSecondaryIndexDescription ::
  ReplicaGlobalSecondaryIndexDescription
newReplicaGlobalSecondaryIndexDescription :: ReplicaGlobalSecondaryIndexDescription
newReplicaGlobalSecondaryIndexDescription =
  ReplicaGlobalSecondaryIndexDescription'
    { $sel:indexName:ReplicaGlobalSecondaryIndexDescription' :: Maybe Text
indexName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedThroughputOverride:ReplicaGlobalSecondaryIndexDescription' :: Maybe ProvisionedThroughputOverride
provisionedThroughputOverride =
        forall a. Maybe a
Prelude.Nothing
    }

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

-- | If not described, uses the source table GSI\'s read capacity settings.
replicaGlobalSecondaryIndexDescription_provisionedThroughputOverride :: Lens.Lens' ReplicaGlobalSecondaryIndexDescription (Prelude.Maybe ProvisionedThroughputOverride)
replicaGlobalSecondaryIndexDescription_provisionedThroughputOverride :: Lens'
  ReplicaGlobalSecondaryIndexDescription
  (Maybe ProvisionedThroughputOverride)
replicaGlobalSecondaryIndexDescription_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)

instance
  Data.FromJSON
    ReplicaGlobalSecondaryIndexDescription
  where
  parseJSON :: Value -> Parser ReplicaGlobalSecondaryIndexDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReplicaGlobalSecondaryIndexDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe ProvisionedThroughputOverride
-> ReplicaGlobalSecondaryIndexDescription
ReplicaGlobalSecondaryIndexDescription'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IndexName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ProvisionedThroughputOverride")
      )

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

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