{-# 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.SecurityHub.Types.AwsDynamoDbTableReplicaGlobalSecondaryIndex
-- 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.SecurityHub.Types.AwsDynamoDbTableReplicaGlobalSecondaryIndex where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsDynamoDbTableProvisionedThroughputOverride

-- | Information about a global secondary index for a DynamoDB table replica.
--
-- /See:/ 'newAwsDynamoDbTableReplicaGlobalSecondaryIndex' smart constructor.
data AwsDynamoDbTableReplicaGlobalSecondaryIndex = AwsDynamoDbTableReplicaGlobalSecondaryIndex'
  { -- | Replica-specific configuration for the provisioned throughput for the
    -- index.
    AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> Maybe AwsDynamoDbTableProvisionedThroughputOverride
provisionedThroughputOverride :: Prelude.Maybe AwsDynamoDbTableProvisionedThroughputOverride,
    -- | The name of the index.
    AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Bool
(AwsDynamoDbTableReplicaGlobalSecondaryIndex
 -> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Bool)
-> (AwsDynamoDbTableReplicaGlobalSecondaryIndex
    -> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Bool)
-> Eq AwsDynamoDbTableReplicaGlobalSecondaryIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Bool
$c/= :: AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Bool
== :: AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Bool
$c== :: AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Bool
Prelude.Eq, ReadPrec [AwsDynamoDbTableReplicaGlobalSecondaryIndex]
ReadPrec AwsDynamoDbTableReplicaGlobalSecondaryIndex
Int -> ReadS AwsDynamoDbTableReplicaGlobalSecondaryIndex
ReadS [AwsDynamoDbTableReplicaGlobalSecondaryIndex]
(Int -> ReadS AwsDynamoDbTableReplicaGlobalSecondaryIndex)
-> ReadS [AwsDynamoDbTableReplicaGlobalSecondaryIndex]
-> ReadPrec AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> ReadPrec [AwsDynamoDbTableReplicaGlobalSecondaryIndex]
-> Read AwsDynamoDbTableReplicaGlobalSecondaryIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsDynamoDbTableReplicaGlobalSecondaryIndex]
$creadListPrec :: ReadPrec [AwsDynamoDbTableReplicaGlobalSecondaryIndex]
readPrec :: ReadPrec AwsDynamoDbTableReplicaGlobalSecondaryIndex
$creadPrec :: ReadPrec AwsDynamoDbTableReplicaGlobalSecondaryIndex
readList :: ReadS [AwsDynamoDbTableReplicaGlobalSecondaryIndex]
$creadList :: ReadS [AwsDynamoDbTableReplicaGlobalSecondaryIndex]
readsPrec :: Int -> ReadS AwsDynamoDbTableReplicaGlobalSecondaryIndex
$creadsPrec :: Int -> ReadS AwsDynamoDbTableReplicaGlobalSecondaryIndex
Prelude.Read, Int -> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> ShowS
[AwsDynamoDbTableReplicaGlobalSecondaryIndex] -> ShowS
AwsDynamoDbTableReplicaGlobalSecondaryIndex -> String
(Int -> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> ShowS)
-> (AwsDynamoDbTableReplicaGlobalSecondaryIndex -> String)
-> ([AwsDynamoDbTableReplicaGlobalSecondaryIndex] -> ShowS)
-> Show AwsDynamoDbTableReplicaGlobalSecondaryIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsDynamoDbTableReplicaGlobalSecondaryIndex] -> ShowS
$cshowList :: [AwsDynamoDbTableReplicaGlobalSecondaryIndex] -> ShowS
show :: AwsDynamoDbTableReplicaGlobalSecondaryIndex -> String
$cshow :: AwsDynamoDbTableReplicaGlobalSecondaryIndex -> String
showsPrec :: Int -> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> ShowS
$cshowsPrec :: Int -> AwsDynamoDbTableReplicaGlobalSecondaryIndex -> ShowS
Prelude.Show, (forall x.
 AwsDynamoDbTableReplicaGlobalSecondaryIndex
 -> Rep AwsDynamoDbTableReplicaGlobalSecondaryIndex x)
-> (forall x.
    Rep AwsDynamoDbTableReplicaGlobalSecondaryIndex x
    -> AwsDynamoDbTableReplicaGlobalSecondaryIndex)
-> Generic AwsDynamoDbTableReplicaGlobalSecondaryIndex
forall x.
Rep AwsDynamoDbTableReplicaGlobalSecondaryIndex x
-> AwsDynamoDbTableReplicaGlobalSecondaryIndex
forall x.
AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> Rep AwsDynamoDbTableReplicaGlobalSecondaryIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsDynamoDbTableReplicaGlobalSecondaryIndex x
-> AwsDynamoDbTableReplicaGlobalSecondaryIndex
$cfrom :: forall x.
AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> Rep AwsDynamoDbTableReplicaGlobalSecondaryIndex x
Prelude.Generic)

-- |
-- Create a value of 'AwsDynamoDbTableReplicaGlobalSecondaryIndex' 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', 'awsDynamoDbTableReplicaGlobalSecondaryIndex_provisionedThroughputOverride' - Replica-specific configuration for the provisioned throughput for the
-- index.
--
-- 'indexName', 'awsDynamoDbTableReplicaGlobalSecondaryIndex_indexName' - The name of the index.
newAwsDynamoDbTableReplicaGlobalSecondaryIndex ::
  AwsDynamoDbTableReplicaGlobalSecondaryIndex
newAwsDynamoDbTableReplicaGlobalSecondaryIndex :: AwsDynamoDbTableReplicaGlobalSecondaryIndex
newAwsDynamoDbTableReplicaGlobalSecondaryIndex =
  AwsDynamoDbTableReplicaGlobalSecondaryIndex' :: Maybe AwsDynamoDbTableProvisionedThroughputOverride
-> Maybe Text -> AwsDynamoDbTableReplicaGlobalSecondaryIndex
AwsDynamoDbTableReplicaGlobalSecondaryIndex'
    { $sel:provisionedThroughputOverride:AwsDynamoDbTableReplicaGlobalSecondaryIndex' :: Maybe AwsDynamoDbTableProvisionedThroughputOverride
provisionedThroughputOverride =
        Maybe AwsDynamoDbTableProvisionedThroughputOverride
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:AwsDynamoDbTableReplicaGlobalSecondaryIndex' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Replica-specific configuration for the provisioned throughput for the
-- index.
awsDynamoDbTableReplicaGlobalSecondaryIndex_provisionedThroughputOverride :: Lens.Lens' AwsDynamoDbTableReplicaGlobalSecondaryIndex (Prelude.Maybe AwsDynamoDbTableProvisionedThroughputOverride)
awsDynamoDbTableReplicaGlobalSecondaryIndex_provisionedThroughputOverride :: (Maybe AwsDynamoDbTableProvisionedThroughputOverride
 -> f (Maybe AwsDynamoDbTableProvisionedThroughputOverride))
-> AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> f AwsDynamoDbTableReplicaGlobalSecondaryIndex
awsDynamoDbTableReplicaGlobalSecondaryIndex_provisionedThroughputOverride = (AwsDynamoDbTableReplicaGlobalSecondaryIndex
 -> Maybe AwsDynamoDbTableProvisionedThroughputOverride)
-> (AwsDynamoDbTableReplicaGlobalSecondaryIndex
    -> Maybe AwsDynamoDbTableProvisionedThroughputOverride
    -> AwsDynamoDbTableReplicaGlobalSecondaryIndex)
-> Lens
     AwsDynamoDbTableReplicaGlobalSecondaryIndex
     AwsDynamoDbTableReplicaGlobalSecondaryIndex
     (Maybe AwsDynamoDbTableProvisionedThroughputOverride)
     (Maybe AwsDynamoDbTableProvisionedThroughputOverride)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableReplicaGlobalSecondaryIndex' {Maybe AwsDynamoDbTableProvisionedThroughputOverride
provisionedThroughputOverride :: Maybe AwsDynamoDbTableProvisionedThroughputOverride
$sel:provisionedThroughputOverride:AwsDynamoDbTableReplicaGlobalSecondaryIndex' :: AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> Maybe AwsDynamoDbTableProvisionedThroughputOverride
provisionedThroughputOverride} -> Maybe AwsDynamoDbTableProvisionedThroughputOverride
provisionedThroughputOverride) (\s :: AwsDynamoDbTableReplicaGlobalSecondaryIndex
s@AwsDynamoDbTableReplicaGlobalSecondaryIndex' {} Maybe AwsDynamoDbTableProvisionedThroughputOverride
a -> AwsDynamoDbTableReplicaGlobalSecondaryIndex
s {$sel:provisionedThroughputOverride:AwsDynamoDbTableReplicaGlobalSecondaryIndex' :: Maybe AwsDynamoDbTableProvisionedThroughputOverride
provisionedThroughputOverride = Maybe AwsDynamoDbTableProvisionedThroughputOverride
a} :: AwsDynamoDbTableReplicaGlobalSecondaryIndex)

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

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

instance
  Prelude.NFData
    AwsDynamoDbTableReplicaGlobalSecondaryIndex

instance
  Core.ToJSON
    AwsDynamoDbTableReplicaGlobalSecondaryIndex
  where
  toJSON :: AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Value
toJSON
    AwsDynamoDbTableReplicaGlobalSecondaryIndex' {Maybe Text
Maybe AwsDynamoDbTableProvisionedThroughputOverride
indexName :: Maybe Text
provisionedThroughputOverride :: Maybe AwsDynamoDbTableProvisionedThroughputOverride
$sel:indexName:AwsDynamoDbTableReplicaGlobalSecondaryIndex' :: AwsDynamoDbTableReplicaGlobalSecondaryIndex -> Maybe Text
$sel:provisionedThroughputOverride:AwsDynamoDbTableReplicaGlobalSecondaryIndex' :: AwsDynamoDbTableReplicaGlobalSecondaryIndex
-> Maybe AwsDynamoDbTableProvisionedThroughputOverride
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"ProvisionedThroughputOverride" Text -> AwsDynamoDbTableProvisionedThroughputOverride -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
                (AwsDynamoDbTableProvisionedThroughputOverride -> Pair)
-> Maybe AwsDynamoDbTableProvisionedThroughputOverride
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsDynamoDbTableProvisionedThroughputOverride
provisionedThroughputOverride,
              (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
            ]
        )