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