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

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

-- | Represents a replica to be created.
--
-- /See:/ 'newCreateReplicationGroupMemberAction' smart constructor.
data CreateReplicationGroupMemberAction = CreateReplicationGroupMemberAction'
  { -- | The AWS KMS customer master key (CMK) that should be used for AWS KMS
    -- encryption in the new replica. To specify a CMK, use its key ID, Amazon
    -- Resource Name (ARN), alias name, or alias ARN. Note that you should only
    -- provide this parameter if the key is different from the default DynamoDB
    -- KMS master key alias\/aws\/dynamodb.
    CreateReplicationGroupMemberAction -> Maybe Text
kmsMasterKeyId :: Prelude.Maybe Prelude.Text,
    -- | Replica-specific provisioned throughput. If not specified, uses the
    -- source table\'s provisioned throughput settings.
    CreateReplicationGroupMemberAction
-> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride :: Prelude.Maybe ProvisionedThroughputOverride,
    -- | Replica-specific global secondary index settings.
    CreateReplicationGroupMemberAction
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes :: Prelude.Maybe (Prelude.NonEmpty ReplicaGlobalSecondaryIndex),
    -- | The Region where the new replica will be created.
    CreateReplicationGroupMemberAction -> Text
regionName :: Prelude.Text
  }
  deriving (CreateReplicationGroupMemberAction
-> CreateReplicationGroupMemberAction -> Bool
(CreateReplicationGroupMemberAction
 -> CreateReplicationGroupMemberAction -> Bool)
-> (CreateReplicationGroupMemberAction
    -> CreateReplicationGroupMemberAction -> Bool)
-> Eq CreateReplicationGroupMemberAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReplicationGroupMemberAction
-> CreateReplicationGroupMemberAction -> Bool
$c/= :: CreateReplicationGroupMemberAction
-> CreateReplicationGroupMemberAction -> Bool
== :: CreateReplicationGroupMemberAction
-> CreateReplicationGroupMemberAction -> Bool
$c== :: CreateReplicationGroupMemberAction
-> CreateReplicationGroupMemberAction -> Bool
Prelude.Eq, ReadPrec [CreateReplicationGroupMemberAction]
ReadPrec CreateReplicationGroupMemberAction
Int -> ReadS CreateReplicationGroupMemberAction
ReadS [CreateReplicationGroupMemberAction]
(Int -> ReadS CreateReplicationGroupMemberAction)
-> ReadS [CreateReplicationGroupMemberAction]
-> ReadPrec CreateReplicationGroupMemberAction
-> ReadPrec [CreateReplicationGroupMemberAction]
-> Read CreateReplicationGroupMemberAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReplicationGroupMemberAction]
$creadListPrec :: ReadPrec [CreateReplicationGroupMemberAction]
readPrec :: ReadPrec CreateReplicationGroupMemberAction
$creadPrec :: ReadPrec CreateReplicationGroupMemberAction
readList :: ReadS [CreateReplicationGroupMemberAction]
$creadList :: ReadS [CreateReplicationGroupMemberAction]
readsPrec :: Int -> ReadS CreateReplicationGroupMemberAction
$creadsPrec :: Int -> ReadS CreateReplicationGroupMemberAction
Prelude.Read, Int -> CreateReplicationGroupMemberAction -> ShowS
[CreateReplicationGroupMemberAction] -> ShowS
CreateReplicationGroupMemberAction -> String
(Int -> CreateReplicationGroupMemberAction -> ShowS)
-> (CreateReplicationGroupMemberAction -> String)
-> ([CreateReplicationGroupMemberAction] -> ShowS)
-> Show CreateReplicationGroupMemberAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReplicationGroupMemberAction] -> ShowS
$cshowList :: [CreateReplicationGroupMemberAction] -> ShowS
show :: CreateReplicationGroupMemberAction -> String
$cshow :: CreateReplicationGroupMemberAction -> String
showsPrec :: Int -> CreateReplicationGroupMemberAction -> ShowS
$cshowsPrec :: Int -> CreateReplicationGroupMemberAction -> ShowS
Prelude.Show, (forall x.
 CreateReplicationGroupMemberAction
 -> Rep CreateReplicationGroupMemberAction x)
-> (forall x.
    Rep CreateReplicationGroupMemberAction x
    -> CreateReplicationGroupMemberAction)
-> Generic CreateReplicationGroupMemberAction
forall x.
Rep CreateReplicationGroupMemberAction x
-> CreateReplicationGroupMemberAction
forall x.
CreateReplicationGroupMemberAction
-> Rep CreateReplicationGroupMemberAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateReplicationGroupMemberAction x
-> CreateReplicationGroupMemberAction
$cfrom :: forall x.
CreateReplicationGroupMemberAction
-> Rep CreateReplicationGroupMemberAction x
Prelude.Generic)

-- |
-- Create a value of 'CreateReplicationGroupMemberAction' 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:
--
-- 'kmsMasterKeyId', 'createReplicationGroupMemberAction_kmsMasterKeyId' - The AWS KMS customer master key (CMK) that should be used for AWS KMS
-- encryption in the new replica. To specify a CMK, use its key ID, Amazon
-- Resource Name (ARN), alias name, or alias ARN. Note that you should only
-- provide this parameter if the key is different from the default DynamoDB
-- KMS master key alias\/aws\/dynamodb.
--
-- 'provisionedThroughputOverride', 'createReplicationGroupMemberAction_provisionedThroughputOverride' - Replica-specific provisioned throughput. If not specified, uses the
-- source table\'s provisioned throughput settings.
--
-- 'globalSecondaryIndexes', 'createReplicationGroupMemberAction_globalSecondaryIndexes' - Replica-specific global secondary index settings.
--
-- 'regionName', 'createReplicationGroupMemberAction_regionName' - The Region where the new replica will be created.
newCreateReplicationGroupMemberAction ::
  -- | 'regionName'
  Prelude.Text ->
  CreateReplicationGroupMemberAction
newCreateReplicationGroupMemberAction :: Text -> CreateReplicationGroupMemberAction
newCreateReplicationGroupMemberAction Text
pRegionName_ =
  CreateReplicationGroupMemberAction' :: Maybe Text
-> Maybe ProvisionedThroughputOverride
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
-> Text
-> CreateReplicationGroupMemberAction
CreateReplicationGroupMemberAction'
    { $sel:kmsMasterKeyId:CreateReplicationGroupMemberAction' :: Maybe Text
kmsMasterKeyId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedThroughputOverride:CreateReplicationGroupMemberAction' :: Maybe ProvisionedThroughputOverride
provisionedThroughputOverride =
        Maybe ProvisionedThroughputOverride
forall a. Maybe a
Prelude.Nothing,
      $sel:globalSecondaryIndexes:CreateReplicationGroupMemberAction' :: Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes =
        Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
forall a. Maybe a
Prelude.Nothing,
      $sel:regionName:CreateReplicationGroupMemberAction' :: Text
regionName = Text
pRegionName_
    }

-- | The AWS KMS customer master key (CMK) that should be used for AWS KMS
-- encryption in the new replica. To specify a CMK, use its key ID, Amazon
-- Resource Name (ARN), alias name, or alias ARN. Note that you should only
-- provide this parameter if the key is different from the default DynamoDB
-- KMS master key alias\/aws\/dynamodb.
createReplicationGroupMemberAction_kmsMasterKeyId :: Lens.Lens' CreateReplicationGroupMemberAction (Prelude.Maybe Prelude.Text)
createReplicationGroupMemberAction_kmsMasterKeyId :: (Maybe Text -> f (Maybe Text))
-> CreateReplicationGroupMemberAction
-> f CreateReplicationGroupMemberAction
createReplicationGroupMemberAction_kmsMasterKeyId = (CreateReplicationGroupMemberAction -> Maybe Text)
-> (CreateReplicationGroupMemberAction
    -> Maybe Text -> CreateReplicationGroupMemberAction)
-> Lens
     CreateReplicationGroupMemberAction
     CreateReplicationGroupMemberAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplicationGroupMemberAction' {Maybe Text
kmsMasterKeyId :: Maybe Text
$sel:kmsMasterKeyId:CreateReplicationGroupMemberAction' :: CreateReplicationGroupMemberAction -> Maybe Text
kmsMasterKeyId} -> Maybe Text
kmsMasterKeyId) (\s :: CreateReplicationGroupMemberAction
s@CreateReplicationGroupMemberAction' {} Maybe Text
a -> CreateReplicationGroupMemberAction
s {$sel:kmsMasterKeyId:CreateReplicationGroupMemberAction' :: Maybe Text
kmsMasterKeyId = Maybe Text
a} :: CreateReplicationGroupMemberAction)

-- | Replica-specific provisioned throughput. If not specified, uses the
-- source table\'s provisioned throughput settings.
createReplicationGroupMemberAction_provisionedThroughputOverride :: Lens.Lens' CreateReplicationGroupMemberAction (Prelude.Maybe ProvisionedThroughputOverride)
createReplicationGroupMemberAction_provisionedThroughputOverride :: (Maybe ProvisionedThroughputOverride
 -> f (Maybe ProvisionedThroughputOverride))
-> CreateReplicationGroupMemberAction
-> f CreateReplicationGroupMemberAction
createReplicationGroupMemberAction_provisionedThroughputOverride = (CreateReplicationGroupMemberAction
 -> Maybe ProvisionedThroughputOverride)
-> (CreateReplicationGroupMemberAction
    -> Maybe ProvisionedThroughputOverride
    -> CreateReplicationGroupMemberAction)
-> Lens
     CreateReplicationGroupMemberAction
     CreateReplicationGroupMemberAction
     (Maybe ProvisionedThroughputOverride)
     (Maybe ProvisionedThroughputOverride)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplicationGroupMemberAction' {Maybe ProvisionedThroughputOverride
provisionedThroughputOverride :: Maybe ProvisionedThroughputOverride
$sel:provisionedThroughputOverride:CreateReplicationGroupMemberAction' :: CreateReplicationGroupMemberAction
-> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride} -> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride) (\s :: CreateReplicationGroupMemberAction
s@CreateReplicationGroupMemberAction' {} Maybe ProvisionedThroughputOverride
a -> CreateReplicationGroupMemberAction
s {$sel:provisionedThroughputOverride:CreateReplicationGroupMemberAction' :: Maybe ProvisionedThroughputOverride
provisionedThroughputOverride = Maybe ProvisionedThroughputOverride
a} :: CreateReplicationGroupMemberAction)

-- | Replica-specific global secondary index settings.
createReplicationGroupMemberAction_globalSecondaryIndexes :: Lens.Lens' CreateReplicationGroupMemberAction (Prelude.Maybe (Prelude.NonEmpty ReplicaGlobalSecondaryIndex))
createReplicationGroupMemberAction_globalSecondaryIndexes :: (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
 -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
-> CreateReplicationGroupMemberAction
-> f CreateReplicationGroupMemberAction
createReplicationGroupMemberAction_globalSecondaryIndexes = (CreateReplicationGroupMemberAction
 -> Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
-> (CreateReplicationGroupMemberAction
    -> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
    -> CreateReplicationGroupMemberAction)
-> Lens
     CreateReplicationGroupMemberAction
     CreateReplicationGroupMemberAction
     (Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
     (Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplicationGroupMemberAction' {Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes :: Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
$sel:globalSecondaryIndexes:CreateReplicationGroupMemberAction' :: CreateReplicationGroupMemberAction
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes} -> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes) (\s :: CreateReplicationGroupMemberAction
s@CreateReplicationGroupMemberAction' {} Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
a -> CreateReplicationGroupMemberAction
s {$sel:globalSecondaryIndexes:CreateReplicationGroupMemberAction' :: Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes = Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
a} :: CreateReplicationGroupMemberAction) ((Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
  -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
 -> CreateReplicationGroupMemberAction
 -> f CreateReplicationGroupMemberAction)
-> ((Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
     -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
    -> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
    -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
-> (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
    -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
-> CreateReplicationGroupMemberAction
-> f CreateReplicationGroupMemberAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ReplicaGlobalSecondaryIndex)
  (NonEmpty ReplicaGlobalSecondaryIndex)
  (NonEmpty ReplicaGlobalSecondaryIndex)
  (NonEmpty ReplicaGlobalSecondaryIndex)
-> Iso
     (Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
     (Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
     (Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
     (Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty ReplicaGlobalSecondaryIndex)
  (NonEmpty ReplicaGlobalSecondaryIndex)
  (NonEmpty ReplicaGlobalSecondaryIndex)
  (NonEmpty ReplicaGlobalSecondaryIndex)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Region where the new replica will be created.
createReplicationGroupMemberAction_regionName :: Lens.Lens' CreateReplicationGroupMemberAction Prelude.Text
createReplicationGroupMemberAction_regionName :: (Text -> f Text)
-> CreateReplicationGroupMemberAction
-> f CreateReplicationGroupMemberAction
createReplicationGroupMemberAction_regionName = (CreateReplicationGroupMemberAction -> Text)
-> (CreateReplicationGroupMemberAction
    -> Text -> CreateReplicationGroupMemberAction)
-> Lens
     CreateReplicationGroupMemberAction
     CreateReplicationGroupMemberAction
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplicationGroupMemberAction' {Text
regionName :: Text
$sel:regionName:CreateReplicationGroupMemberAction' :: CreateReplicationGroupMemberAction -> Text
regionName} -> Text
regionName) (\s :: CreateReplicationGroupMemberAction
s@CreateReplicationGroupMemberAction' {} Text
a -> CreateReplicationGroupMemberAction
s {$sel:regionName:CreateReplicationGroupMemberAction' :: Text
regionName = Text
a} :: CreateReplicationGroupMemberAction)

instance
  Prelude.Hashable
    CreateReplicationGroupMemberAction

instance
  Prelude.NFData
    CreateReplicationGroupMemberAction

instance
  Core.ToJSON
    CreateReplicationGroupMemberAction
  where
  toJSON :: CreateReplicationGroupMemberAction -> Value
toJSON CreateReplicationGroupMemberAction' {Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
Maybe Text
Maybe ProvisionedThroughputOverride
Text
regionName :: Text
globalSecondaryIndexes :: Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
provisionedThroughputOverride :: Maybe ProvisionedThroughputOverride
kmsMasterKeyId :: Maybe Text
$sel:regionName:CreateReplicationGroupMemberAction' :: CreateReplicationGroupMemberAction -> Text
$sel:globalSecondaryIndexes:CreateReplicationGroupMemberAction' :: CreateReplicationGroupMemberAction
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
$sel:provisionedThroughputOverride:CreateReplicationGroupMemberAction' :: CreateReplicationGroupMemberAction
-> Maybe ProvisionedThroughputOverride
$sel:kmsMasterKeyId:CreateReplicationGroupMemberAction' :: CreateReplicationGroupMemberAction -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"KMSMasterKeyId" 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
kmsMasterKeyId,
            (Text
"ProvisionedThroughputOverride" Text -> ProvisionedThroughputOverride -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ProvisionedThroughputOverride -> Pair)
-> Maybe ProvisionedThroughputOverride -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride,
            (Text
"GlobalSecondaryIndexes" Text -> NonEmpty ReplicaGlobalSecondaryIndex -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty ReplicaGlobalSecondaryIndex -> Pair)
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RegionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
regionName)
          ]
      )