{-# 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 #-}
module Amazonka.DynamoDB.Types.Replica where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Replica = Replica'
{
Replica -> Maybe Text
regionName :: Prelude.Maybe Prelude.Text
}
deriving (Replica -> Replica -> Bool
(Replica -> Replica -> Bool)
-> (Replica -> Replica -> Bool) -> Eq Replica
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Replica -> Replica -> Bool
$c/= :: Replica -> Replica -> Bool
== :: Replica -> Replica -> Bool
$c== :: Replica -> Replica -> Bool
Prelude.Eq, ReadPrec [Replica]
ReadPrec Replica
Int -> ReadS Replica
ReadS [Replica]
(Int -> ReadS Replica)
-> ReadS [Replica]
-> ReadPrec Replica
-> ReadPrec [Replica]
-> Read Replica
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Replica]
$creadListPrec :: ReadPrec [Replica]
readPrec :: ReadPrec Replica
$creadPrec :: ReadPrec Replica
readList :: ReadS [Replica]
$creadList :: ReadS [Replica]
readsPrec :: Int -> ReadS Replica
$creadsPrec :: Int -> ReadS Replica
Prelude.Read, Int -> Replica -> ShowS
[Replica] -> ShowS
Replica -> String
(Int -> Replica -> ShowS)
-> (Replica -> String) -> ([Replica] -> ShowS) -> Show Replica
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Replica] -> ShowS
$cshowList :: [Replica] -> ShowS
show :: Replica -> String
$cshow :: Replica -> String
showsPrec :: Int -> Replica -> ShowS
$cshowsPrec :: Int -> Replica -> ShowS
Prelude.Show, (forall x. Replica -> Rep Replica x)
-> (forall x. Rep Replica x -> Replica) -> Generic Replica
forall x. Rep Replica x -> Replica
forall x. Replica -> Rep Replica x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Replica x -> Replica
$cfrom :: forall x. Replica -> Rep Replica x
Prelude.Generic)
newReplica ::
Replica
newReplica :: Replica
newReplica = Replica' :: Maybe Text -> Replica
Replica' {$sel:regionName:Replica' :: Maybe Text
regionName = Maybe Text
forall a. Maybe a
Prelude.Nothing}
replica_regionName :: Lens.Lens' Replica (Prelude.Maybe Prelude.Text)
replica_regionName :: (Maybe Text -> f (Maybe Text)) -> Replica -> f Replica
replica_regionName = (Replica -> Maybe Text)
-> (Replica -> Maybe Text -> Replica)
-> Lens Replica Replica (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Replica' {Maybe Text
regionName :: Maybe Text
$sel:regionName:Replica' :: Replica -> Maybe Text
regionName} -> Maybe Text
regionName) (\s :: Replica
s@Replica' {} Maybe Text
a -> Replica
s {$sel:regionName:Replica' :: Maybe Text
regionName = Maybe Text
a} :: Replica)
instance Core.FromJSON Replica where
parseJSON :: Value -> Parser Replica
parseJSON =
String -> (Object -> Parser Replica) -> Value -> Parser Replica
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Replica"
( \Object
x ->
Maybe Text -> Replica
Replica' (Maybe Text -> Replica) -> Parser (Maybe Text) -> Parser Replica
forall (f :: * -> *) a b. Functor 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
"RegionName")
)
instance Prelude.Hashable Replica
instance Prelude.NFData Replica
instance Core.ToJSON Replica where
toJSON :: Replica -> Value
toJSON Replica' {Maybe Text
regionName :: Maybe Text
$sel:regionName:Replica' :: Replica -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"RegionName" 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
regionName]
)