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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DeleteReplicaAction -> DeleteReplicaAction -> Bool)
-> (DeleteReplicaAction -> DeleteReplicaAction -> Bool)
-> Eq DeleteReplicaAction
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]
(Int -> ReadS DeleteReplicaAction)
-> ReadS [DeleteReplicaAction]
-> ReadPrec DeleteReplicaAction
-> ReadPrec [DeleteReplicaAction]
-> Read 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
(Int -> DeleteReplicaAction -> ShowS)
-> (DeleteReplicaAction -> String)
-> ([DeleteReplicaAction] -> ShowS)
-> Show DeleteReplicaAction
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. DeleteReplicaAction -> Rep DeleteReplicaAction x)
-> (forall x. Rep DeleteReplicaAction x -> DeleteReplicaAction)
-> Generic DeleteReplicaAction
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' :: Text -> DeleteReplicaAction
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 :: (Text -> f Text) -> DeleteReplicaAction -> f DeleteReplicaAction
deleteReplicaAction_regionName = (DeleteReplicaAction -> Text)
-> (DeleteReplicaAction -> Text -> DeleteReplicaAction)
-> Lens DeleteReplicaAction DeleteReplicaAction Text Text
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

instance Prelude.NFData DeleteReplicaAction

instance Core.ToJSON DeleteReplicaAction where
  toJSON :: DeleteReplicaAction -> Value
toJSON DeleteReplicaAction' {Text
regionName :: Text
$sel:regionName:DeleteReplicaAction' :: DeleteReplicaAction -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [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)]
      )