{-# 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.UpdateReplicationGroupMemberAction
-- 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.UpdateReplicationGroupMemberAction 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 modified.
--
-- /See:/ 'newUpdateReplicationGroupMemberAction' smart constructor.
data UpdateReplicationGroupMemberAction = UpdateReplicationGroupMemberAction'
  { -- | The AWS KMS customer master key (CMK) of the replica that should be used
    -- for AWS KMS encryption. 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.
    UpdateReplicationGroupMemberAction -> Maybe Text
kmsMasterKeyId :: Prelude.Maybe Prelude.Text,
    -- | Replica-specific provisioned throughput. If not specified, uses the
    -- source table\'s provisioned throughput settings.
    UpdateReplicationGroupMemberAction
-> Maybe ProvisionedThroughputOverride
provisionedThroughputOverride :: Prelude.Maybe ProvisionedThroughputOverride,
    -- | Replica-specific global secondary index settings.
    UpdateReplicationGroupMemberAction
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes :: Prelude.Maybe (Prelude.NonEmpty ReplicaGlobalSecondaryIndex),
    -- | The Region where the replica exists.
    UpdateReplicationGroupMemberAction -> Text
regionName :: Prelude.Text
  }
  deriving (UpdateReplicationGroupMemberAction
-> UpdateReplicationGroupMemberAction -> Bool
(UpdateReplicationGroupMemberAction
 -> UpdateReplicationGroupMemberAction -> Bool)
-> (UpdateReplicationGroupMemberAction
    -> UpdateReplicationGroupMemberAction -> Bool)
-> Eq UpdateReplicationGroupMemberAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateReplicationGroupMemberAction
-> UpdateReplicationGroupMemberAction -> Bool
$c/= :: UpdateReplicationGroupMemberAction
-> UpdateReplicationGroupMemberAction -> Bool
== :: UpdateReplicationGroupMemberAction
-> UpdateReplicationGroupMemberAction -> Bool
$c== :: UpdateReplicationGroupMemberAction
-> UpdateReplicationGroupMemberAction -> Bool
Prelude.Eq, ReadPrec [UpdateReplicationGroupMemberAction]
ReadPrec UpdateReplicationGroupMemberAction
Int -> ReadS UpdateReplicationGroupMemberAction
ReadS [UpdateReplicationGroupMemberAction]
(Int -> ReadS UpdateReplicationGroupMemberAction)
-> ReadS [UpdateReplicationGroupMemberAction]
-> ReadPrec UpdateReplicationGroupMemberAction
-> ReadPrec [UpdateReplicationGroupMemberAction]
-> Read UpdateReplicationGroupMemberAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateReplicationGroupMemberAction]
$creadListPrec :: ReadPrec [UpdateReplicationGroupMemberAction]
readPrec :: ReadPrec UpdateReplicationGroupMemberAction
$creadPrec :: ReadPrec UpdateReplicationGroupMemberAction
readList :: ReadS [UpdateReplicationGroupMemberAction]
$creadList :: ReadS [UpdateReplicationGroupMemberAction]
readsPrec :: Int -> ReadS UpdateReplicationGroupMemberAction
$creadsPrec :: Int -> ReadS UpdateReplicationGroupMemberAction
Prelude.Read, Int -> UpdateReplicationGroupMemberAction -> ShowS
[UpdateReplicationGroupMemberAction] -> ShowS
UpdateReplicationGroupMemberAction -> String
(Int -> UpdateReplicationGroupMemberAction -> ShowS)
-> (UpdateReplicationGroupMemberAction -> String)
-> ([UpdateReplicationGroupMemberAction] -> ShowS)
-> Show UpdateReplicationGroupMemberAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateReplicationGroupMemberAction] -> ShowS
$cshowList :: [UpdateReplicationGroupMemberAction] -> ShowS
show :: UpdateReplicationGroupMemberAction -> String
$cshow :: UpdateReplicationGroupMemberAction -> String
showsPrec :: Int -> UpdateReplicationGroupMemberAction -> ShowS
$cshowsPrec :: Int -> UpdateReplicationGroupMemberAction -> ShowS
Prelude.Show, (forall x.
 UpdateReplicationGroupMemberAction
 -> Rep UpdateReplicationGroupMemberAction x)
-> (forall x.
    Rep UpdateReplicationGroupMemberAction x
    -> UpdateReplicationGroupMemberAction)
-> Generic UpdateReplicationGroupMemberAction
forall x.
Rep UpdateReplicationGroupMemberAction x
-> UpdateReplicationGroupMemberAction
forall x.
UpdateReplicationGroupMemberAction
-> Rep UpdateReplicationGroupMemberAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateReplicationGroupMemberAction x
-> UpdateReplicationGroupMemberAction
$cfrom :: forall x.
UpdateReplicationGroupMemberAction
-> Rep UpdateReplicationGroupMemberAction x
Prelude.Generic)

-- |
-- Create a value of 'UpdateReplicationGroupMemberAction' 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', 'updateReplicationGroupMemberAction_kmsMasterKeyId' - The AWS KMS customer master key (CMK) of the replica that should be used
-- for AWS KMS encryption. 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', 'updateReplicationGroupMemberAction_provisionedThroughputOverride' - Replica-specific provisioned throughput. If not specified, uses the
-- source table\'s provisioned throughput settings.
--
-- 'globalSecondaryIndexes', 'updateReplicationGroupMemberAction_globalSecondaryIndexes' - Replica-specific global secondary index settings.
--
-- 'regionName', 'updateReplicationGroupMemberAction_regionName' - The Region where the replica exists.
newUpdateReplicationGroupMemberAction ::
  -- | 'regionName'
  Prelude.Text ->
  UpdateReplicationGroupMemberAction
newUpdateReplicationGroupMemberAction :: Text -> UpdateReplicationGroupMemberAction
newUpdateReplicationGroupMemberAction Text
pRegionName_ =
  UpdateReplicationGroupMemberAction' :: Maybe Text
-> Maybe ProvisionedThroughputOverride
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
-> Text
-> UpdateReplicationGroupMemberAction
UpdateReplicationGroupMemberAction'
    { $sel:kmsMasterKeyId:UpdateReplicationGroupMemberAction' :: Maybe Text
kmsMasterKeyId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedThroughputOverride:UpdateReplicationGroupMemberAction' :: Maybe ProvisionedThroughputOverride
provisionedThroughputOverride =
        Maybe ProvisionedThroughputOverride
forall a. Maybe a
Prelude.Nothing,
      $sel:globalSecondaryIndexes:UpdateReplicationGroupMemberAction' :: Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes =
        Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
forall a. Maybe a
Prelude.Nothing,
      $sel:regionName:UpdateReplicationGroupMemberAction' :: Text
regionName = Text
pRegionName_
    }

-- | The AWS KMS customer master key (CMK) of the replica that should be used
-- for AWS KMS encryption. 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.
updateReplicationGroupMemberAction_kmsMasterKeyId :: Lens.Lens' UpdateReplicationGroupMemberAction (Prelude.Maybe Prelude.Text)
updateReplicationGroupMemberAction_kmsMasterKeyId :: (Maybe Text -> f (Maybe Text))
-> UpdateReplicationGroupMemberAction
-> f UpdateReplicationGroupMemberAction
updateReplicationGroupMemberAction_kmsMasterKeyId = (UpdateReplicationGroupMemberAction -> Maybe Text)
-> (UpdateReplicationGroupMemberAction
    -> Maybe Text -> UpdateReplicationGroupMemberAction)
-> Lens
     UpdateReplicationGroupMemberAction
     UpdateReplicationGroupMemberAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateReplicationGroupMemberAction' {Maybe Text
kmsMasterKeyId :: Maybe Text
$sel:kmsMasterKeyId:UpdateReplicationGroupMemberAction' :: UpdateReplicationGroupMemberAction -> Maybe Text
kmsMasterKeyId} -> Maybe Text
kmsMasterKeyId) (\s :: UpdateReplicationGroupMemberAction
s@UpdateReplicationGroupMemberAction' {} Maybe Text
a -> UpdateReplicationGroupMemberAction
s {$sel:kmsMasterKeyId:UpdateReplicationGroupMemberAction' :: Maybe Text
kmsMasterKeyId = Maybe Text
a} :: UpdateReplicationGroupMemberAction)

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

-- | Replica-specific global secondary index settings.
updateReplicationGroupMemberAction_globalSecondaryIndexes :: Lens.Lens' UpdateReplicationGroupMemberAction (Prelude.Maybe (Prelude.NonEmpty ReplicaGlobalSecondaryIndex))
updateReplicationGroupMemberAction_globalSecondaryIndexes :: (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
 -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
-> UpdateReplicationGroupMemberAction
-> f UpdateReplicationGroupMemberAction
updateReplicationGroupMemberAction_globalSecondaryIndexes = (UpdateReplicationGroupMemberAction
 -> Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
-> (UpdateReplicationGroupMemberAction
    -> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
    -> UpdateReplicationGroupMemberAction)
-> Lens
     UpdateReplicationGroupMemberAction
     UpdateReplicationGroupMemberAction
     (Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
     (Maybe (NonEmpty ReplicaGlobalSecondaryIndex))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateReplicationGroupMemberAction' {Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes :: Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
$sel:globalSecondaryIndexes:UpdateReplicationGroupMemberAction' :: UpdateReplicationGroupMemberAction
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes} -> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes) (\s :: UpdateReplicationGroupMemberAction
s@UpdateReplicationGroupMemberAction' {} Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
a -> UpdateReplicationGroupMemberAction
s {$sel:globalSecondaryIndexes:UpdateReplicationGroupMemberAction' :: Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
globalSecondaryIndexes = Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
a} :: UpdateReplicationGroupMemberAction) ((Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
  -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
 -> UpdateReplicationGroupMemberAction
 -> f UpdateReplicationGroupMemberAction)
-> ((Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
     -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
    -> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
    -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
-> (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
    -> f (Maybe (NonEmpty ReplicaGlobalSecondaryIndex)))
-> UpdateReplicationGroupMemberAction
-> f UpdateReplicationGroupMemberAction
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 replica exists.
updateReplicationGroupMemberAction_regionName :: Lens.Lens' UpdateReplicationGroupMemberAction Prelude.Text
updateReplicationGroupMemberAction_regionName :: (Text -> f Text)
-> UpdateReplicationGroupMemberAction
-> f UpdateReplicationGroupMemberAction
updateReplicationGroupMemberAction_regionName = (UpdateReplicationGroupMemberAction -> Text)
-> (UpdateReplicationGroupMemberAction
    -> Text -> UpdateReplicationGroupMemberAction)
-> Lens
     UpdateReplicationGroupMemberAction
     UpdateReplicationGroupMemberAction
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateReplicationGroupMemberAction' {Text
regionName :: Text
$sel:regionName:UpdateReplicationGroupMemberAction' :: UpdateReplicationGroupMemberAction -> Text
regionName} -> Text
regionName) (\s :: UpdateReplicationGroupMemberAction
s@UpdateReplicationGroupMemberAction' {} Text
a -> UpdateReplicationGroupMemberAction
s {$sel:regionName:UpdateReplicationGroupMemberAction' :: Text
regionName = Text
a} :: UpdateReplicationGroupMemberAction)

instance
  Prelude.Hashable
    UpdateReplicationGroupMemberAction

instance
  Prelude.NFData
    UpdateReplicationGroupMemberAction

instance
  Core.ToJSON
    UpdateReplicationGroupMemberAction
  where
  toJSON :: UpdateReplicationGroupMemberAction -> Value
toJSON UpdateReplicationGroupMemberAction' {Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
Maybe Text
Maybe ProvisionedThroughputOverride
Text
regionName :: Text
globalSecondaryIndexes :: Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
provisionedThroughputOverride :: Maybe ProvisionedThroughputOverride
kmsMasterKeyId :: Maybe Text
$sel:regionName:UpdateReplicationGroupMemberAction' :: UpdateReplicationGroupMemberAction -> Text
$sel:globalSecondaryIndexes:UpdateReplicationGroupMemberAction' :: UpdateReplicationGroupMemberAction
-> Maybe (NonEmpty ReplicaGlobalSecondaryIndex)
$sel:provisionedThroughputOverride:UpdateReplicationGroupMemberAction' :: UpdateReplicationGroupMemberAction
-> Maybe ProvisionedThroughputOverride
$sel:kmsMasterKeyId:UpdateReplicationGroupMemberAction' :: UpdateReplicationGroupMemberAction -> 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)
          ]
      )