{-# 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.ReplicaUpdate where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.CreateReplicaAction
import Amazonka.DynamoDB.Types.DeleteReplicaAction
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ReplicaUpdate = ReplicaUpdate'
{
ReplicaUpdate -> Maybe CreateReplicaAction
create :: Prelude.Maybe CreateReplicaAction,
ReplicaUpdate -> Maybe DeleteReplicaAction
delete' :: Prelude.Maybe DeleteReplicaAction
}
deriving (ReplicaUpdate -> ReplicaUpdate -> Bool
(ReplicaUpdate -> ReplicaUpdate -> Bool)
-> (ReplicaUpdate -> ReplicaUpdate -> Bool) -> Eq ReplicaUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaUpdate -> ReplicaUpdate -> Bool
$c/= :: ReplicaUpdate -> ReplicaUpdate -> Bool
== :: ReplicaUpdate -> ReplicaUpdate -> Bool
$c== :: ReplicaUpdate -> ReplicaUpdate -> Bool
Prelude.Eq, ReadPrec [ReplicaUpdate]
ReadPrec ReplicaUpdate
Int -> ReadS ReplicaUpdate
ReadS [ReplicaUpdate]
(Int -> ReadS ReplicaUpdate)
-> ReadS [ReplicaUpdate]
-> ReadPrec ReplicaUpdate
-> ReadPrec [ReplicaUpdate]
-> Read ReplicaUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaUpdate]
$creadListPrec :: ReadPrec [ReplicaUpdate]
readPrec :: ReadPrec ReplicaUpdate
$creadPrec :: ReadPrec ReplicaUpdate
readList :: ReadS [ReplicaUpdate]
$creadList :: ReadS [ReplicaUpdate]
readsPrec :: Int -> ReadS ReplicaUpdate
$creadsPrec :: Int -> ReadS ReplicaUpdate
Prelude.Read, Int -> ReplicaUpdate -> ShowS
[ReplicaUpdate] -> ShowS
ReplicaUpdate -> String
(Int -> ReplicaUpdate -> ShowS)
-> (ReplicaUpdate -> String)
-> ([ReplicaUpdate] -> ShowS)
-> Show ReplicaUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaUpdate] -> ShowS
$cshowList :: [ReplicaUpdate] -> ShowS
show :: ReplicaUpdate -> String
$cshow :: ReplicaUpdate -> String
showsPrec :: Int -> ReplicaUpdate -> ShowS
$cshowsPrec :: Int -> ReplicaUpdate -> ShowS
Prelude.Show, (forall x. ReplicaUpdate -> Rep ReplicaUpdate x)
-> (forall x. Rep ReplicaUpdate x -> ReplicaUpdate)
-> Generic ReplicaUpdate
forall x. Rep ReplicaUpdate x -> ReplicaUpdate
forall x. ReplicaUpdate -> Rep ReplicaUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplicaUpdate x -> ReplicaUpdate
$cfrom :: forall x. ReplicaUpdate -> Rep ReplicaUpdate x
Prelude.Generic)
newReplicaUpdate ::
ReplicaUpdate
newReplicaUpdate :: ReplicaUpdate
newReplicaUpdate =
ReplicaUpdate' :: Maybe CreateReplicaAction
-> Maybe DeleteReplicaAction -> ReplicaUpdate
ReplicaUpdate'
{ $sel:create:ReplicaUpdate' :: Maybe CreateReplicaAction
create = Maybe CreateReplicaAction
forall a. Maybe a
Prelude.Nothing,
$sel:delete':ReplicaUpdate' :: Maybe DeleteReplicaAction
delete' = Maybe DeleteReplicaAction
forall a. Maybe a
Prelude.Nothing
}
replicaUpdate_create :: Lens.Lens' ReplicaUpdate (Prelude.Maybe CreateReplicaAction)
replicaUpdate_create :: (Maybe CreateReplicaAction -> f (Maybe CreateReplicaAction))
-> ReplicaUpdate -> f ReplicaUpdate
replicaUpdate_create = (ReplicaUpdate -> Maybe CreateReplicaAction)
-> (ReplicaUpdate -> Maybe CreateReplicaAction -> ReplicaUpdate)
-> Lens
ReplicaUpdate
ReplicaUpdate
(Maybe CreateReplicaAction)
(Maybe CreateReplicaAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaUpdate' {Maybe CreateReplicaAction
create :: Maybe CreateReplicaAction
$sel:create:ReplicaUpdate' :: ReplicaUpdate -> Maybe CreateReplicaAction
create} -> Maybe CreateReplicaAction
create) (\s :: ReplicaUpdate
s@ReplicaUpdate' {} Maybe CreateReplicaAction
a -> ReplicaUpdate
s {$sel:create:ReplicaUpdate' :: Maybe CreateReplicaAction
create = Maybe CreateReplicaAction
a} :: ReplicaUpdate)
replicaUpdate_delete :: Lens.Lens' ReplicaUpdate (Prelude.Maybe DeleteReplicaAction)
replicaUpdate_delete :: (Maybe DeleteReplicaAction -> f (Maybe DeleteReplicaAction))
-> ReplicaUpdate -> f ReplicaUpdate
replicaUpdate_delete = (ReplicaUpdate -> Maybe DeleteReplicaAction)
-> (ReplicaUpdate -> Maybe DeleteReplicaAction -> ReplicaUpdate)
-> Lens
ReplicaUpdate
ReplicaUpdate
(Maybe DeleteReplicaAction)
(Maybe DeleteReplicaAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaUpdate' {Maybe DeleteReplicaAction
delete' :: Maybe DeleteReplicaAction
$sel:delete':ReplicaUpdate' :: ReplicaUpdate -> Maybe DeleteReplicaAction
delete'} -> Maybe DeleteReplicaAction
delete') (\s :: ReplicaUpdate
s@ReplicaUpdate' {} Maybe DeleteReplicaAction
a -> ReplicaUpdate
s {$sel:delete':ReplicaUpdate' :: Maybe DeleteReplicaAction
delete' = Maybe DeleteReplicaAction
a} :: ReplicaUpdate)
instance Prelude.Hashable ReplicaUpdate
instance Prelude.NFData ReplicaUpdate
instance Core.ToJSON ReplicaUpdate where
toJSON :: ReplicaUpdate -> Value
toJSON ReplicaUpdate' {Maybe CreateReplicaAction
Maybe DeleteReplicaAction
delete' :: Maybe DeleteReplicaAction
create :: Maybe CreateReplicaAction
$sel:delete':ReplicaUpdate' :: ReplicaUpdate -> Maybe DeleteReplicaAction
$sel:create:ReplicaUpdate' :: ReplicaUpdate -> Maybe CreateReplicaAction
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Create" Text -> CreateReplicaAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CreateReplicaAction -> Pair)
-> Maybe CreateReplicaAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateReplicaAction
create,
(Text
"Delete" Text -> DeleteReplicaAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DeleteReplicaAction -> Pair)
-> Maybe DeleteReplicaAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeleteReplicaAction
delete'
]
)