{-# 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.ConditionCheck where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.ReturnValuesOnConditionCheckFailure
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude
data ConditionCheck = ConditionCheck'
{
ConditionCheck -> Maybe (HashMap Text Text)
expressionAttributeNames :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
ConditionCheck -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues :: Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue),
ConditionCheck -> Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure :: Prelude.Maybe ReturnValuesOnConditionCheckFailure,
ConditionCheck -> HashMap Text AttributeValue
key :: Prelude.HashMap Prelude.Text AttributeValue,
ConditionCheck -> Text
tableName :: Prelude.Text,
ConditionCheck -> Text
conditionExpression :: Prelude.Text
}
deriving (ConditionCheck -> ConditionCheck -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConditionCheck -> ConditionCheck -> Bool
$c/= :: ConditionCheck -> ConditionCheck -> Bool
== :: ConditionCheck -> ConditionCheck -> Bool
$c== :: ConditionCheck -> ConditionCheck -> Bool
Prelude.Eq, ReadPrec [ConditionCheck]
ReadPrec ConditionCheck
Int -> ReadS ConditionCheck
ReadS [ConditionCheck]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConditionCheck]
$creadListPrec :: ReadPrec [ConditionCheck]
readPrec :: ReadPrec ConditionCheck
$creadPrec :: ReadPrec ConditionCheck
readList :: ReadS [ConditionCheck]
$creadList :: ReadS [ConditionCheck]
readsPrec :: Int -> ReadS ConditionCheck
$creadsPrec :: Int -> ReadS ConditionCheck
Prelude.Read, Int -> ConditionCheck -> ShowS
[ConditionCheck] -> ShowS
ConditionCheck -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConditionCheck] -> ShowS
$cshowList :: [ConditionCheck] -> ShowS
show :: ConditionCheck -> String
$cshow :: ConditionCheck -> String
showsPrec :: Int -> ConditionCheck -> ShowS
$cshowsPrec :: Int -> ConditionCheck -> ShowS
Prelude.Show, forall x. Rep ConditionCheck x -> ConditionCheck
forall x. ConditionCheck -> Rep ConditionCheck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConditionCheck x -> ConditionCheck
$cfrom :: forall x. ConditionCheck -> Rep ConditionCheck x
Prelude.Generic)
newConditionCheck ::
Prelude.Text ->
Prelude.Text ->
ConditionCheck
newConditionCheck :: Text -> Text -> ConditionCheck
newConditionCheck Text
pTableName_ Text
pConditionExpression_ =
ConditionCheck'
{ $sel:expressionAttributeNames:ConditionCheck' :: Maybe (HashMap Text Text)
expressionAttributeNames =
forall a. Maybe a
Prelude.Nothing,
$sel:expressionAttributeValues:ConditionCheck' :: Maybe (HashMap Text AttributeValue)
expressionAttributeValues = forall a. Maybe a
Prelude.Nothing,
$sel:returnValuesOnConditionCheckFailure:ConditionCheck' :: Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure =
forall a. Maybe a
Prelude.Nothing,
$sel:key:ConditionCheck' :: HashMap Text AttributeValue
key = forall a. Monoid a => a
Prelude.mempty,
$sel:tableName:ConditionCheck' :: Text
tableName = Text
pTableName_,
$sel:conditionExpression:ConditionCheck' :: Text
conditionExpression = Text
pConditionExpression_
}
conditionCheck_expressionAttributeNames :: Lens.Lens' ConditionCheck (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
conditionCheck_expressionAttributeNames :: Lens' ConditionCheck (Maybe (HashMap Text Text))
conditionCheck_expressionAttributeNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionCheck' {Maybe (HashMap Text Text)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:expressionAttributeNames:ConditionCheck' :: ConditionCheck -> Maybe (HashMap Text Text)
expressionAttributeNames} -> Maybe (HashMap Text Text)
expressionAttributeNames) (\s :: ConditionCheck
s@ConditionCheck' {} Maybe (HashMap Text Text)
a -> ConditionCheck
s {$sel:expressionAttributeNames:ConditionCheck' :: Maybe (HashMap Text Text)
expressionAttributeNames = Maybe (HashMap Text Text)
a} :: ConditionCheck) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
conditionCheck_expressionAttributeValues :: Lens.Lens' ConditionCheck (Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue))
conditionCheck_expressionAttributeValues :: Lens' ConditionCheck (Maybe (HashMap Text AttributeValue))
conditionCheck_expressionAttributeValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionCheck' {Maybe (HashMap Text AttributeValue)
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeValues:ConditionCheck' :: ConditionCheck -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues} -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues) (\s :: ConditionCheck
s@ConditionCheck' {} Maybe (HashMap Text AttributeValue)
a -> ConditionCheck
s {$sel:expressionAttributeValues:ConditionCheck' :: Maybe (HashMap Text AttributeValue)
expressionAttributeValues = Maybe (HashMap Text AttributeValue)
a} :: ConditionCheck) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
conditionCheck_returnValuesOnConditionCheckFailure :: Lens.Lens' ConditionCheck (Prelude.Maybe ReturnValuesOnConditionCheckFailure)
conditionCheck_returnValuesOnConditionCheckFailure :: Lens' ConditionCheck (Maybe ReturnValuesOnConditionCheckFailure)
conditionCheck_returnValuesOnConditionCheckFailure = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionCheck' {Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure :: Maybe ReturnValuesOnConditionCheckFailure
$sel:returnValuesOnConditionCheckFailure:ConditionCheck' :: ConditionCheck -> Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure} -> Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure) (\s :: ConditionCheck
s@ConditionCheck' {} Maybe ReturnValuesOnConditionCheckFailure
a -> ConditionCheck
s {$sel:returnValuesOnConditionCheckFailure:ConditionCheck' :: Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure = Maybe ReturnValuesOnConditionCheckFailure
a} :: ConditionCheck)
conditionCheck_key :: Lens.Lens' ConditionCheck (Prelude.HashMap Prelude.Text AttributeValue)
conditionCheck_key :: Lens' ConditionCheck (HashMap Text AttributeValue)
conditionCheck_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionCheck' {HashMap Text AttributeValue
key :: HashMap Text AttributeValue
$sel:key:ConditionCheck' :: ConditionCheck -> HashMap Text AttributeValue
key} -> HashMap Text AttributeValue
key) (\s :: ConditionCheck
s@ConditionCheck' {} HashMap Text AttributeValue
a -> ConditionCheck
s {$sel:key:ConditionCheck' :: HashMap Text AttributeValue
key = HashMap Text AttributeValue
a} :: ConditionCheck) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
conditionCheck_tableName :: Lens.Lens' ConditionCheck Prelude.Text
conditionCheck_tableName :: Lens' ConditionCheck Text
conditionCheck_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionCheck' {Text
tableName :: Text
$sel:tableName:ConditionCheck' :: ConditionCheck -> Text
tableName} -> Text
tableName) (\s :: ConditionCheck
s@ConditionCheck' {} Text
a -> ConditionCheck
s {$sel:tableName:ConditionCheck' :: Text
tableName = Text
a} :: ConditionCheck)
conditionCheck_conditionExpression :: Lens.Lens' ConditionCheck Prelude.Text
conditionCheck_conditionExpression :: Lens' ConditionCheck Text
conditionCheck_conditionExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionCheck' {Text
conditionExpression :: Text
$sel:conditionExpression:ConditionCheck' :: ConditionCheck -> Text
conditionExpression} -> Text
conditionExpression) (\s :: ConditionCheck
s@ConditionCheck' {} Text
a -> ConditionCheck
s {$sel:conditionExpression:ConditionCheck' :: Text
conditionExpression = Text
a} :: ConditionCheck)
instance Prelude.Hashable ConditionCheck where
hashWithSalt :: Int -> ConditionCheck -> Int
hashWithSalt Int
_salt ConditionCheck' {Maybe (HashMap Text Text)
Maybe (HashMap Text AttributeValue)
Maybe ReturnValuesOnConditionCheckFailure
Text
HashMap Text AttributeValue
conditionExpression :: Text
tableName :: Text
key :: HashMap Text AttributeValue
returnValuesOnConditionCheckFailure :: Maybe ReturnValuesOnConditionCheckFailure
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:conditionExpression:ConditionCheck' :: ConditionCheck -> Text
$sel:tableName:ConditionCheck' :: ConditionCheck -> Text
$sel:key:ConditionCheck' :: ConditionCheck -> HashMap Text AttributeValue
$sel:returnValuesOnConditionCheckFailure:ConditionCheck' :: ConditionCheck -> Maybe ReturnValuesOnConditionCheckFailure
$sel:expressionAttributeValues:ConditionCheck' :: ConditionCheck -> Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeNames:ConditionCheck' :: ConditionCheck -> Maybe (HashMap Text Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
expressionAttributeNames
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text AttributeValue)
expressionAttributeValues
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text AttributeValue
key
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
conditionExpression
instance Prelude.NFData ConditionCheck where
rnf :: ConditionCheck -> ()
rnf ConditionCheck' {Maybe (HashMap Text Text)
Maybe (HashMap Text AttributeValue)
Maybe ReturnValuesOnConditionCheckFailure
Text
HashMap Text AttributeValue
conditionExpression :: Text
tableName :: Text
key :: HashMap Text AttributeValue
returnValuesOnConditionCheckFailure :: Maybe ReturnValuesOnConditionCheckFailure
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:conditionExpression:ConditionCheck' :: ConditionCheck -> Text
$sel:tableName:ConditionCheck' :: ConditionCheck -> Text
$sel:key:ConditionCheck' :: ConditionCheck -> HashMap Text AttributeValue
$sel:returnValuesOnConditionCheckFailure:ConditionCheck' :: ConditionCheck -> Maybe ReturnValuesOnConditionCheckFailure
$sel:expressionAttributeValues:ConditionCheck' :: ConditionCheck -> Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeNames:ConditionCheck' :: ConditionCheck -> Maybe (HashMap Text Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
expressionAttributeNames
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text AttributeValue)
expressionAttributeValues
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text AttributeValue
key
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
conditionExpression
instance Data.ToJSON ConditionCheck where
toJSON :: ConditionCheck -> Value
toJSON ConditionCheck' {Maybe (HashMap Text Text)
Maybe (HashMap Text AttributeValue)
Maybe ReturnValuesOnConditionCheckFailure
Text
HashMap Text AttributeValue
conditionExpression :: Text
tableName :: Text
key :: HashMap Text AttributeValue
returnValuesOnConditionCheckFailure :: Maybe ReturnValuesOnConditionCheckFailure
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:conditionExpression:ConditionCheck' :: ConditionCheck -> Text
$sel:tableName:ConditionCheck' :: ConditionCheck -> Text
$sel:key:ConditionCheck' :: ConditionCheck -> HashMap Text AttributeValue
$sel:returnValuesOnConditionCheckFailure:ConditionCheck' :: ConditionCheck -> Maybe ReturnValuesOnConditionCheckFailure
$sel:expressionAttributeValues:ConditionCheck' :: ConditionCheck -> Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeNames:ConditionCheck' :: ConditionCheck -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ExpressionAttributeNames" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
expressionAttributeNames,
(Key
"ExpressionAttributeValues" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text AttributeValue)
expressionAttributeValues,
(Key
"ReturnValuesOnConditionCheckFailure" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReturnValuesOnConditionCheckFailure
returnValuesOnConditionCheckFailure,
forall a. a -> Maybe a
Prelude.Just (Key
"Key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HashMap Text AttributeValue
key),
forall a. a -> Maybe a
Prelude.Just (Key
"TableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
forall a. a -> Maybe a
Prelude.Just
(Key
"ConditionExpression" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
conditionExpression)
]
)