{-# 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.Put where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.ReturnValuesOnConditionCheckFailure
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Put = Put'
{
Put -> Maybe (HashMap Text Text)
expressionAttributeNames :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Put -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues :: Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue),
Put -> Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure :: Prelude.Maybe ReturnValuesOnConditionCheckFailure,
Put -> Maybe Text
conditionExpression :: Prelude.Maybe Prelude.Text,
Put -> HashMap Text AttributeValue
item :: Prelude.HashMap Prelude.Text AttributeValue,
Put -> Text
tableName :: Prelude.Text
}
deriving (Put -> Put -> Bool
(Put -> Put -> Bool) -> (Put -> Put -> Bool) -> Eq Put
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Put -> Put -> Bool
$c/= :: Put -> Put -> Bool
== :: Put -> Put -> Bool
$c== :: Put -> Put -> Bool
Prelude.Eq, ReadPrec [Put]
ReadPrec Put
Int -> ReadS Put
ReadS [Put]
(Int -> ReadS Put)
-> ReadS [Put] -> ReadPrec Put -> ReadPrec [Put] -> Read Put
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Put]
$creadListPrec :: ReadPrec [Put]
readPrec :: ReadPrec Put
$creadPrec :: ReadPrec Put
readList :: ReadS [Put]
$creadList :: ReadS [Put]
readsPrec :: Int -> ReadS Put
$creadsPrec :: Int -> ReadS Put
Prelude.Read, Int -> Put -> ShowS
[Put] -> ShowS
Put -> String
(Int -> Put -> ShowS)
-> (Put -> String) -> ([Put] -> ShowS) -> Show Put
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Put] -> ShowS
$cshowList :: [Put] -> ShowS
show :: Put -> String
$cshow :: Put -> String
showsPrec :: Int -> Put -> ShowS
$cshowsPrec :: Int -> Put -> ShowS
Prelude.Show, (forall x. Put -> Rep Put x)
-> (forall x. Rep Put x -> Put) -> Generic Put
forall x. Rep Put x -> Put
forall x. Put -> Rep Put x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Put x -> Put
$cfrom :: forall x. Put -> Rep Put x
Prelude.Generic)
newPut ::
Prelude.Text ->
Put
newPut :: Text -> Put
newPut Text
pTableName_ =
Put' :: Maybe (HashMap Text Text)
-> Maybe (HashMap Text AttributeValue)
-> Maybe ReturnValuesOnConditionCheckFailure
-> Maybe Text
-> HashMap Text AttributeValue
-> Text
-> Put
Put'
{ $sel:expressionAttributeNames:Put' :: Maybe (HashMap Text Text)
expressionAttributeNames = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:expressionAttributeValues:Put' :: Maybe (HashMap Text AttributeValue)
expressionAttributeValues = Maybe (HashMap Text AttributeValue)
forall a. Maybe a
Prelude.Nothing,
$sel:returnValuesOnConditionCheckFailure:Put' :: Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure =
Maybe ReturnValuesOnConditionCheckFailure
forall a. Maybe a
Prelude.Nothing,
$sel:conditionExpression:Put' :: Maybe Text
conditionExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:item:Put' :: HashMap Text AttributeValue
item = HashMap Text AttributeValue
forall a. Monoid a => a
Prelude.mempty,
$sel:tableName:Put' :: Text
tableName = Text
pTableName_
}
put_expressionAttributeNames :: Lens.Lens' Put (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
put_expressionAttributeNames :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Put -> f Put
put_expressionAttributeNames = (Put -> Maybe (HashMap Text Text))
-> (Put -> Maybe (HashMap Text Text) -> Put)
-> Lens
Put Put (Maybe (HashMap Text Text)) (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Put' {Maybe (HashMap Text Text)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:expressionAttributeNames:Put' :: Put -> Maybe (HashMap Text Text)
expressionAttributeNames} -> Maybe (HashMap Text Text)
expressionAttributeNames) (\s :: Put
s@Put' {} Maybe (HashMap Text Text)
a -> Put
s {$sel:expressionAttributeNames:Put' :: Maybe (HashMap Text Text)
expressionAttributeNames = Maybe (HashMap Text Text)
a} :: Put) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Put -> f Put)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Put
-> f Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
put_expressionAttributeValues :: Lens.Lens' Put (Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue))
put_expressionAttributeValues :: (Maybe (HashMap Text AttributeValue)
-> f (Maybe (HashMap Text AttributeValue)))
-> Put -> f Put
put_expressionAttributeValues = (Put -> Maybe (HashMap Text AttributeValue))
-> (Put -> Maybe (HashMap Text AttributeValue) -> Put)
-> Lens
Put
Put
(Maybe (HashMap Text AttributeValue))
(Maybe (HashMap Text AttributeValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Put' {Maybe (HashMap Text AttributeValue)
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeValues:Put' :: Put -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues} -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues) (\s :: Put
s@Put' {} Maybe (HashMap Text AttributeValue)
a -> Put
s {$sel:expressionAttributeValues:Put' :: Maybe (HashMap Text AttributeValue)
expressionAttributeValues = Maybe (HashMap Text AttributeValue)
a} :: Put) ((Maybe (HashMap Text AttributeValue)
-> f (Maybe (HashMap Text AttributeValue)))
-> Put -> f Put)
-> ((Maybe (HashMap Text AttributeValue)
-> f (Maybe (HashMap Text AttributeValue)))
-> Maybe (HashMap Text AttributeValue)
-> f (Maybe (HashMap Text AttributeValue)))
-> (Maybe (HashMap Text AttributeValue)
-> f (Maybe (HashMap Text AttributeValue)))
-> Put
-> f Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text AttributeValue)
(HashMap Text AttributeValue)
(HashMap Text AttributeValue)
(HashMap Text AttributeValue)
-> Iso
(Maybe (HashMap Text AttributeValue))
(Maybe (HashMap Text AttributeValue))
(Maybe (HashMap Text AttributeValue))
(Maybe (HashMap Text AttributeValue))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text AttributeValue)
(HashMap Text AttributeValue)
(HashMap Text AttributeValue)
(HashMap Text AttributeValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
put_returnValuesOnConditionCheckFailure :: Lens.Lens' Put (Prelude.Maybe ReturnValuesOnConditionCheckFailure)
put_returnValuesOnConditionCheckFailure :: (Maybe ReturnValuesOnConditionCheckFailure
-> f (Maybe ReturnValuesOnConditionCheckFailure))
-> Put -> f Put
put_returnValuesOnConditionCheckFailure = (Put -> Maybe ReturnValuesOnConditionCheckFailure)
-> (Put -> Maybe ReturnValuesOnConditionCheckFailure -> Put)
-> Lens
Put
Put
(Maybe ReturnValuesOnConditionCheckFailure)
(Maybe ReturnValuesOnConditionCheckFailure)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Put' {Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure :: Maybe ReturnValuesOnConditionCheckFailure
$sel:returnValuesOnConditionCheckFailure:Put' :: Put -> Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure} -> Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure) (\s :: Put
s@Put' {} Maybe ReturnValuesOnConditionCheckFailure
a -> Put
s {$sel:returnValuesOnConditionCheckFailure:Put' :: Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure = Maybe ReturnValuesOnConditionCheckFailure
a} :: Put)
put_conditionExpression :: Lens.Lens' Put (Prelude.Maybe Prelude.Text)
put_conditionExpression :: (Maybe Text -> f (Maybe Text)) -> Put -> f Put
put_conditionExpression = (Put -> Maybe Text)
-> (Put -> Maybe Text -> Put)
-> Lens Put Put (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Put' {Maybe Text
conditionExpression :: Maybe Text
$sel:conditionExpression:Put' :: Put -> Maybe Text
conditionExpression} -> Maybe Text
conditionExpression) (\s :: Put
s@Put' {} Maybe Text
a -> Put
s {$sel:conditionExpression:Put' :: Maybe Text
conditionExpression = Maybe Text
a} :: Put)
put_item :: Lens.Lens' Put (Prelude.HashMap Prelude.Text AttributeValue)
put_item :: (HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> Put -> f Put
put_item = (Put -> HashMap Text AttributeValue)
-> (Put -> HashMap Text AttributeValue -> Put)
-> Lens
Put Put (HashMap Text AttributeValue) (HashMap Text AttributeValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Put' {HashMap Text AttributeValue
item :: HashMap Text AttributeValue
$sel:item:Put' :: Put -> HashMap Text AttributeValue
item} -> HashMap Text AttributeValue
item) (\s :: Put
s@Put' {} HashMap Text AttributeValue
a -> Put
s {$sel:item:Put' :: HashMap Text AttributeValue
item = HashMap Text AttributeValue
a} :: Put) ((HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> Put -> f Put)
-> ((HashMap Text AttributeValue
-> f (HashMap Text AttributeValue))
-> HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> (HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> Put
-> f Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> HashMap Text AttributeValue -> f (HashMap Text AttributeValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
put_tableName :: Lens.Lens' Put Prelude.Text
put_tableName :: (Text -> f Text) -> Put -> f Put
put_tableName = (Put -> Text) -> (Put -> Text -> Put) -> Lens Put Put Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Put' {Text
tableName :: Text
$sel:tableName:Put' :: Put -> Text
tableName} -> Text
tableName) (\s :: Put
s@Put' {} Text
a -> Put
s {$sel:tableName:Put' :: Text
tableName = Text
a} :: Put)
instance Prelude.Hashable Put
instance Prelude.NFData Put
instance Core.ToJSON Put where
toJSON :: Put -> Value
toJSON Put' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text AttributeValue)
Maybe ReturnValuesOnConditionCheckFailure
Text
HashMap Text AttributeValue
tableName :: Text
item :: HashMap Text AttributeValue
conditionExpression :: Maybe Text
returnValuesOnConditionCheckFailure :: Maybe ReturnValuesOnConditionCheckFailure
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:tableName:Put' :: Put -> Text
$sel:item:Put' :: Put -> HashMap Text AttributeValue
$sel:conditionExpression:Put' :: Put -> Maybe Text
$sel:returnValuesOnConditionCheckFailure:Put' :: Put -> Maybe ReturnValuesOnConditionCheckFailure
$sel:expressionAttributeValues:Put' :: Put -> Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeNames:Put' :: Put -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ExpressionAttributeNames" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
expressionAttributeNames,
(Text
"ExpressionAttributeValues" Text -> HashMap Text AttributeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text AttributeValue -> Pair)
-> Maybe (HashMap Text AttributeValue) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text AttributeValue)
expressionAttributeValues,
(Text
"ReturnValuesOnConditionCheckFailure" Text -> ReturnValuesOnConditionCheckFailure -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ReturnValuesOnConditionCheckFailure -> Pair)
-> Maybe ReturnValuesOnConditionCheckFailure -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure,
(Text
"ConditionExpression" 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
conditionExpression,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Item" Text -> HashMap Text AttributeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text AttributeValue
item),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName)
]
)