{-# 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.DeleteReplicaAction
-- 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.DeleteReplicaAction 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.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Represents a replica to be removed.
--
-- /See:/ 'newDeleteReplicaAction' smart constructor.
data DeleteReplicaAction = DeleteReplicaAction'
  { -- | The Region of the replica to be removed.
    DeleteReplicaAction -> Text
regionName :: Prelude.Text
  }
  deriving (DeleteReplicaAction -> DeleteReplicaAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteReplicaAction -> DeleteReplicaAction -> Bool
$c/= :: DeleteReplicaAction -> DeleteReplicaAction -> Bool
== :: DeleteReplicaAction -> DeleteReplicaAction -> Bool
$c== :: DeleteReplicaAction -> DeleteReplicaAction -> Bool
Prelude.Eq, ReadPrec [DeleteReplicaAction]
ReadPrec DeleteReplicaAction
Int -> ReadS DeleteReplicaAction
ReadS [DeleteReplicaAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteReplicaAction]
$creadListPrec :: ReadPrec [DeleteReplicaAction]
readPrec :: ReadPrec DeleteReplicaAction
$creadPrec :: ReadPrec DeleteReplicaAction
readList :: ReadS [DeleteReplicaAction]
$creadList :: ReadS [DeleteReplicaAction]
readsPrec :: Int -> ReadS DeleteReplicaAction
$creadsPrec :: Int -> ReadS DeleteReplicaAction
Prelude.Read, Int -> DeleteReplicaAction -> ShowS
[DeleteReplicaAction] -> ShowS
DeleteReplicaAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteReplicaAction] -> ShowS
$cshowList :: [DeleteReplicaAction] -> ShowS
show :: DeleteReplicaAction -> String
$cshow :: DeleteReplicaAction -> String
showsPrec :: Int -> DeleteReplicaAction -> ShowS
$cshowsPrec :: Int -> DeleteReplicaAction -> ShowS
Prelude.Show, forall x. Rep DeleteReplicaAction x -> DeleteReplicaAction
forall x. DeleteReplicaAction -> Rep DeleteReplicaAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteReplicaAction x -> DeleteReplicaAction
$cfrom :: forall x. DeleteReplicaAction -> Rep DeleteReplicaAction x
Prelude.Generic)

-- |
-- Create a value of 'DeleteReplicaAction' 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:
--
-- 'regionName', 'deleteReplicaAction_regionName' - The Region of the replica to be removed.
newDeleteReplicaAction ::
  -- | 'regionName'
  Prelude.Text ->
  DeleteReplicaAction
newDeleteReplicaAction :: Text -> DeleteReplicaAction
newDeleteReplicaAction Text
pRegionName_ =
  DeleteReplicaAction' {$sel:regionName:DeleteReplicaAction' :: Text
regionName = Text
pRegionName_}

-- | The Region of the replica to be removed.
deleteReplicaAction_regionName :: Lens.Lens' DeleteReplicaAction Prelude.Text
deleteReplicaAction_regionName :: Lens' DeleteReplicaAction Text
deleteReplicaAction_regionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteReplicaAction' {Text
regionName :: Text
$sel:regionName:DeleteReplicaAction' :: DeleteReplicaAction -> Text
regionName} -> Text
regionName) (\s :: DeleteReplicaAction
s@DeleteReplicaAction' {} Text
a -> DeleteReplicaAction
s {$sel:regionName:DeleteReplicaAction' :: Text
regionName = Text
a} :: DeleteReplicaAction)

instance Prelude.Hashable DeleteReplicaAction where
  hashWithSalt :: Int -> DeleteReplicaAction -> Int
hashWithSalt Int
_salt DeleteReplicaAction' {Text
regionName :: Text
$sel:regionName:DeleteReplicaAction' :: DeleteReplicaAction -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
regionName

instance Prelude.NFData DeleteReplicaAction where
  rnf :: DeleteReplicaAction -> ()
rnf DeleteReplicaAction' {Text
regionName :: Text
$sel:regionName:DeleteReplicaAction' :: DeleteReplicaAction -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
regionName

instance Data.ToJSON DeleteReplicaAction where
  toJSON :: DeleteReplicaAction -> Value
toJSON DeleteReplicaAction' {Text
regionName :: Text
$sel:regionName:DeleteReplicaAction' :: DeleteReplicaAction -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"RegionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
regionName)]
      )