{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.DynamoDB.PutItem
(
PutItem (..),
newPutItem,
putItem_conditionExpression,
putItem_conditionalOperator,
putItem_expected,
putItem_expressionAttributeNames,
putItem_expressionAttributeValues,
putItem_returnConsumedCapacity,
putItem_returnItemCollectionMetrics,
putItem_returnValues,
putItem_tableName,
putItem_item,
PutItemResponse (..),
newPutItemResponse,
putItemResponse_attributes,
putItemResponse_consumedCapacity,
putItemResponse_itemCollectionMetrics,
putItemResponse_httpStatus,
)
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
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutItem = PutItem'
{
PutItem -> Maybe Text
conditionExpression :: Prelude.Maybe Prelude.Text,
PutItem -> Maybe ConditionalOperator
conditionalOperator :: Prelude.Maybe ConditionalOperator,
PutItem -> Maybe (HashMap Text ExpectedAttributeValue)
expected :: Prelude.Maybe (Prelude.HashMap Prelude.Text ExpectedAttributeValue),
PutItem -> Maybe (HashMap Text Text)
expressionAttributeNames :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
PutItem -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues :: Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue),
PutItem -> Maybe ReturnConsumedCapacity
returnConsumedCapacity :: Prelude.Maybe ReturnConsumedCapacity,
PutItem -> Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics :: Prelude.Maybe ReturnItemCollectionMetrics,
PutItem -> Maybe ReturnValue
returnValues :: Prelude.Maybe ReturnValue,
PutItem -> Text
tableName :: Prelude.Text,
PutItem -> HashMap Text AttributeValue
item :: Prelude.HashMap Prelude.Text AttributeValue
}
deriving (PutItem -> PutItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutItem -> PutItem -> Bool
$c/= :: PutItem -> PutItem -> Bool
== :: PutItem -> PutItem -> Bool
$c== :: PutItem -> PutItem -> Bool
Prelude.Eq, ReadPrec [PutItem]
ReadPrec PutItem
Int -> ReadS PutItem
ReadS [PutItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutItem]
$creadListPrec :: ReadPrec [PutItem]
readPrec :: ReadPrec PutItem
$creadPrec :: ReadPrec PutItem
readList :: ReadS [PutItem]
$creadList :: ReadS [PutItem]
readsPrec :: Int -> ReadS PutItem
$creadsPrec :: Int -> ReadS PutItem
Prelude.Read, Int -> PutItem -> ShowS
[PutItem] -> ShowS
PutItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutItem] -> ShowS
$cshowList :: [PutItem] -> ShowS
show :: PutItem -> String
$cshow :: PutItem -> String
showsPrec :: Int -> PutItem -> ShowS
$cshowsPrec :: Int -> PutItem -> ShowS
Prelude.Show, forall x. Rep PutItem x -> PutItem
forall x. PutItem -> Rep PutItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutItem x -> PutItem
$cfrom :: forall x. PutItem -> Rep PutItem x
Prelude.Generic)
newPutItem ::
Prelude.Text ->
PutItem
newPutItem :: Text -> PutItem
newPutItem Text
pTableName_ =
PutItem'
{ $sel:conditionExpression:PutItem' :: Maybe Text
conditionExpression = forall a. Maybe a
Prelude.Nothing,
$sel:conditionalOperator:PutItem' :: Maybe ConditionalOperator
conditionalOperator = forall a. Maybe a
Prelude.Nothing,
$sel:expected:PutItem' :: Maybe (HashMap Text ExpectedAttributeValue)
expected = forall a. Maybe a
Prelude.Nothing,
$sel:expressionAttributeNames:PutItem' :: Maybe (HashMap Text Text)
expressionAttributeNames = forall a. Maybe a
Prelude.Nothing,
$sel:expressionAttributeValues:PutItem' :: Maybe (HashMap Text AttributeValue)
expressionAttributeValues = forall a. Maybe a
Prelude.Nothing,
$sel:returnConsumedCapacity:PutItem' :: Maybe ReturnConsumedCapacity
returnConsumedCapacity = forall a. Maybe a
Prelude.Nothing,
$sel:returnItemCollectionMetrics:PutItem' :: Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics = forall a. Maybe a
Prelude.Nothing,
$sel:returnValues:PutItem' :: Maybe ReturnValue
returnValues = forall a. Maybe a
Prelude.Nothing,
$sel:tableName:PutItem' :: Text
tableName = Text
pTableName_,
$sel:item:PutItem' :: HashMap Text AttributeValue
item = forall a. Monoid a => a
Prelude.mempty
}
putItem_conditionExpression :: Lens.Lens' PutItem (Prelude.Maybe Prelude.Text)
putItem_conditionExpression :: Lens' PutItem (Maybe Text)
putItem_conditionExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Maybe Text
conditionExpression :: Maybe Text
$sel:conditionExpression:PutItem' :: PutItem -> Maybe Text
conditionExpression} -> Maybe Text
conditionExpression) (\s :: PutItem
s@PutItem' {} Maybe Text
a -> PutItem
s {$sel:conditionExpression:PutItem' :: Maybe Text
conditionExpression = Maybe Text
a} :: PutItem)
putItem_conditionalOperator :: Lens.Lens' PutItem (Prelude.Maybe ConditionalOperator)
putItem_conditionalOperator :: Lens' PutItem (Maybe ConditionalOperator)
putItem_conditionalOperator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Maybe ConditionalOperator
conditionalOperator :: Maybe ConditionalOperator
$sel:conditionalOperator:PutItem' :: PutItem -> Maybe ConditionalOperator
conditionalOperator} -> Maybe ConditionalOperator
conditionalOperator) (\s :: PutItem
s@PutItem' {} Maybe ConditionalOperator
a -> PutItem
s {$sel:conditionalOperator:PutItem' :: Maybe ConditionalOperator
conditionalOperator = Maybe ConditionalOperator
a} :: PutItem)
putItem_expected :: Lens.Lens' PutItem (Prelude.Maybe (Prelude.HashMap Prelude.Text ExpectedAttributeValue))
putItem_expected :: Lens' PutItem (Maybe (HashMap Text ExpectedAttributeValue))
putItem_expected = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Maybe (HashMap Text ExpectedAttributeValue)
expected :: Maybe (HashMap Text ExpectedAttributeValue)
$sel:expected:PutItem' :: PutItem -> Maybe (HashMap Text ExpectedAttributeValue)
expected} -> Maybe (HashMap Text ExpectedAttributeValue)
expected) (\s :: PutItem
s@PutItem' {} Maybe (HashMap Text ExpectedAttributeValue)
a -> PutItem
s {$sel:expected:PutItem' :: Maybe (HashMap Text ExpectedAttributeValue)
expected = Maybe (HashMap Text ExpectedAttributeValue)
a} :: PutItem) 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
putItem_expressionAttributeNames :: Lens.Lens' PutItem (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
putItem_expressionAttributeNames :: Lens' PutItem (Maybe (HashMap Text Text))
putItem_expressionAttributeNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Maybe (HashMap Text Text)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:expressionAttributeNames:PutItem' :: PutItem -> Maybe (HashMap Text Text)
expressionAttributeNames} -> Maybe (HashMap Text Text)
expressionAttributeNames) (\s :: PutItem
s@PutItem' {} Maybe (HashMap Text Text)
a -> PutItem
s {$sel:expressionAttributeNames:PutItem' :: Maybe (HashMap Text Text)
expressionAttributeNames = Maybe (HashMap Text Text)
a} :: PutItem) 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
putItem_expressionAttributeValues :: Lens.Lens' PutItem (Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue))
putItem_expressionAttributeValues :: Lens' PutItem (Maybe (HashMap Text AttributeValue))
putItem_expressionAttributeValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Maybe (HashMap Text AttributeValue)
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeValues:PutItem' :: PutItem -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues} -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues) (\s :: PutItem
s@PutItem' {} Maybe (HashMap Text AttributeValue)
a -> PutItem
s {$sel:expressionAttributeValues:PutItem' :: Maybe (HashMap Text AttributeValue)
expressionAttributeValues = Maybe (HashMap Text AttributeValue)
a} :: PutItem) 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
putItem_returnConsumedCapacity :: Lens.Lens' PutItem (Prelude.Maybe ReturnConsumedCapacity)
putItem_returnConsumedCapacity :: Lens' PutItem (Maybe ReturnConsumedCapacity)
putItem_returnConsumedCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Maybe ReturnConsumedCapacity
returnConsumedCapacity :: Maybe ReturnConsumedCapacity
$sel:returnConsumedCapacity:PutItem' :: PutItem -> Maybe ReturnConsumedCapacity
returnConsumedCapacity} -> Maybe ReturnConsumedCapacity
returnConsumedCapacity) (\s :: PutItem
s@PutItem' {} Maybe ReturnConsumedCapacity
a -> PutItem
s {$sel:returnConsumedCapacity:PutItem' :: Maybe ReturnConsumedCapacity
returnConsumedCapacity = Maybe ReturnConsumedCapacity
a} :: PutItem)
putItem_returnItemCollectionMetrics :: Lens.Lens' PutItem (Prelude.Maybe ReturnItemCollectionMetrics)
putItem_returnItemCollectionMetrics :: Lens' PutItem (Maybe ReturnItemCollectionMetrics)
putItem_returnItemCollectionMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics :: Maybe ReturnItemCollectionMetrics
$sel:returnItemCollectionMetrics:PutItem' :: PutItem -> Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics} -> Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics) (\s :: PutItem
s@PutItem' {} Maybe ReturnItemCollectionMetrics
a -> PutItem
s {$sel:returnItemCollectionMetrics:PutItem' :: Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics = Maybe ReturnItemCollectionMetrics
a} :: PutItem)
putItem_returnValues :: Lens.Lens' PutItem (Prelude.Maybe ReturnValue)
putItem_returnValues :: Lens' PutItem (Maybe ReturnValue)
putItem_returnValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Maybe ReturnValue
returnValues :: Maybe ReturnValue
$sel:returnValues:PutItem' :: PutItem -> Maybe ReturnValue
returnValues} -> Maybe ReturnValue
returnValues) (\s :: PutItem
s@PutItem' {} Maybe ReturnValue
a -> PutItem
s {$sel:returnValues:PutItem' :: Maybe ReturnValue
returnValues = Maybe ReturnValue
a} :: PutItem)
putItem_tableName :: Lens.Lens' PutItem Prelude.Text
putItem_tableName :: Lens' PutItem Text
putItem_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {Text
tableName :: Text
$sel:tableName:PutItem' :: PutItem -> Text
tableName} -> Text
tableName) (\s :: PutItem
s@PutItem' {} Text
a -> PutItem
s {$sel:tableName:PutItem' :: Text
tableName = Text
a} :: PutItem)
putItem_item :: Lens.Lens' PutItem (Prelude.HashMap Prelude.Text AttributeValue)
putItem_item :: Lens' PutItem (HashMap Text AttributeValue)
putItem_item = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItem' {HashMap Text AttributeValue
item :: HashMap Text AttributeValue
$sel:item:PutItem' :: PutItem -> HashMap Text AttributeValue
item} -> HashMap Text AttributeValue
item) (\s :: PutItem
s@PutItem' {} HashMap Text AttributeValue
a -> PutItem
s {$sel:item:PutItem' :: HashMap Text AttributeValue
item = HashMap Text AttributeValue
a} :: PutItem) 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
instance Core.AWSRequest PutItem where
type AWSResponse PutItem = PutItemResponse
request :: (Service -> Service) -> PutItem -> Request PutItem
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutItem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutItem)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe (HashMap Text AttributeValue)
-> Maybe ConsumedCapacity
-> Maybe ItemCollectionMetrics
-> Int
-> PutItemResponse
PutItemResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Attributes" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ConsumedCapacity")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ItemCollectionMetrics")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutItem where
hashWithSalt :: Int -> PutItem -> Int
hashWithSalt Int
_salt PutItem' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text AttributeValue)
Maybe (HashMap Text ExpectedAttributeValue)
Maybe ReturnValue
Maybe ReturnItemCollectionMetrics
Maybe ReturnConsumedCapacity
Maybe ConditionalOperator
Text
HashMap Text AttributeValue
item :: HashMap Text AttributeValue
tableName :: Text
returnValues :: Maybe ReturnValue
returnItemCollectionMetrics :: Maybe ReturnItemCollectionMetrics
returnConsumedCapacity :: Maybe ReturnConsumedCapacity
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
expressionAttributeNames :: Maybe (HashMap Text Text)
expected :: Maybe (HashMap Text ExpectedAttributeValue)
conditionalOperator :: Maybe ConditionalOperator
conditionExpression :: Maybe Text
$sel:item:PutItem' :: PutItem -> HashMap Text AttributeValue
$sel:tableName:PutItem' :: PutItem -> Text
$sel:returnValues:PutItem' :: PutItem -> Maybe ReturnValue
$sel:returnItemCollectionMetrics:PutItem' :: PutItem -> Maybe ReturnItemCollectionMetrics
$sel:returnConsumedCapacity:PutItem' :: PutItem -> Maybe ReturnConsumedCapacity
$sel:expressionAttributeValues:PutItem' :: PutItem -> Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeNames:PutItem' :: PutItem -> Maybe (HashMap Text Text)
$sel:expected:PutItem' :: PutItem -> Maybe (HashMap Text ExpectedAttributeValue)
$sel:conditionalOperator:PutItem' :: PutItem -> Maybe ConditionalOperator
$sel:conditionExpression:PutItem' :: PutItem -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
conditionExpression
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConditionalOperator
conditionalOperator
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ExpectedAttributeValue)
expected
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 ReturnConsumedCapacity
returnConsumedCapacity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReturnValue
returnValues
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text AttributeValue
item
instance Prelude.NFData PutItem where
rnf :: PutItem -> ()
rnf PutItem' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text AttributeValue)
Maybe (HashMap Text ExpectedAttributeValue)
Maybe ReturnValue
Maybe ReturnItemCollectionMetrics
Maybe ReturnConsumedCapacity
Maybe ConditionalOperator
Text
HashMap Text AttributeValue
item :: HashMap Text AttributeValue
tableName :: Text
returnValues :: Maybe ReturnValue
returnItemCollectionMetrics :: Maybe ReturnItemCollectionMetrics
returnConsumedCapacity :: Maybe ReturnConsumedCapacity
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
expressionAttributeNames :: Maybe (HashMap Text Text)
expected :: Maybe (HashMap Text ExpectedAttributeValue)
conditionalOperator :: Maybe ConditionalOperator
conditionExpression :: Maybe Text
$sel:item:PutItem' :: PutItem -> HashMap Text AttributeValue
$sel:tableName:PutItem' :: PutItem -> Text
$sel:returnValues:PutItem' :: PutItem -> Maybe ReturnValue
$sel:returnItemCollectionMetrics:PutItem' :: PutItem -> Maybe ReturnItemCollectionMetrics
$sel:returnConsumedCapacity:PutItem' :: PutItem -> Maybe ReturnConsumedCapacity
$sel:expressionAttributeValues:PutItem' :: PutItem -> Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeNames:PutItem' :: PutItem -> Maybe (HashMap Text Text)
$sel:expected:PutItem' :: PutItem -> Maybe (HashMap Text ExpectedAttributeValue)
$sel:conditionalOperator:PutItem' :: PutItem -> Maybe ConditionalOperator
$sel:conditionExpression:PutItem' :: PutItem -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
conditionExpression
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConditionalOperator
conditionalOperator
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ExpectedAttributeValue)
expected
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 ReturnConsumedCapacity
returnConsumedCapacity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReturnValue
returnValues
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 HashMap Text AttributeValue
item
instance Data.ToHeaders PutItem where
toHeaders :: PutItem -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"DynamoDB_20120810.PutItem" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON PutItem where
toJSON :: PutItem -> Value
toJSON PutItem' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text AttributeValue)
Maybe (HashMap Text ExpectedAttributeValue)
Maybe ReturnValue
Maybe ReturnItemCollectionMetrics
Maybe ReturnConsumedCapacity
Maybe ConditionalOperator
Text
HashMap Text AttributeValue
item :: HashMap Text AttributeValue
tableName :: Text
returnValues :: Maybe ReturnValue
returnItemCollectionMetrics :: Maybe ReturnItemCollectionMetrics
returnConsumedCapacity :: Maybe ReturnConsumedCapacity
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
expressionAttributeNames :: Maybe (HashMap Text Text)
expected :: Maybe (HashMap Text ExpectedAttributeValue)
conditionalOperator :: Maybe ConditionalOperator
conditionExpression :: Maybe Text
$sel:item:PutItem' :: PutItem -> HashMap Text AttributeValue
$sel:tableName:PutItem' :: PutItem -> Text
$sel:returnValues:PutItem' :: PutItem -> Maybe ReturnValue
$sel:returnItemCollectionMetrics:PutItem' :: PutItem -> Maybe ReturnItemCollectionMetrics
$sel:returnConsumedCapacity:PutItem' :: PutItem -> Maybe ReturnConsumedCapacity
$sel:expressionAttributeValues:PutItem' :: PutItem -> Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeNames:PutItem' :: PutItem -> Maybe (HashMap Text Text)
$sel:expected:PutItem' :: PutItem -> Maybe (HashMap Text ExpectedAttributeValue)
$sel:conditionalOperator:PutItem' :: PutItem -> Maybe ConditionalOperator
$sel:conditionExpression:PutItem' :: PutItem -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ConditionExpression" 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 Text
conditionExpression,
(Key
"ConditionalOperator" 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 ConditionalOperator
conditionalOperator,
(Key
"Expected" 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 ExpectedAttributeValue)
expected,
(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
"ReturnConsumedCapacity" 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 ReturnConsumedCapacity
returnConsumedCapacity,
(Key
"ReturnItemCollectionMetrics" 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 ReturnItemCollectionMetrics
returnItemCollectionMetrics,
(Key
"ReturnValues" 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 ReturnValue
returnValues,
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
"Item" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HashMap Text AttributeValue
item)
]
)
instance Data.ToPath PutItem where
toPath :: PutItem -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutItem where
toQuery :: PutItem -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutItemResponse = PutItemResponse'
{
PutItemResponse -> Maybe (HashMap Text AttributeValue)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue),
PutItemResponse -> Maybe ConsumedCapacity
consumedCapacity :: Prelude.Maybe ConsumedCapacity,
PutItemResponse -> Maybe ItemCollectionMetrics
itemCollectionMetrics :: Prelude.Maybe ItemCollectionMetrics,
PutItemResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutItemResponse -> PutItemResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutItemResponse -> PutItemResponse -> Bool
$c/= :: PutItemResponse -> PutItemResponse -> Bool
== :: PutItemResponse -> PutItemResponse -> Bool
$c== :: PutItemResponse -> PutItemResponse -> Bool
Prelude.Eq, ReadPrec [PutItemResponse]
ReadPrec PutItemResponse
Int -> ReadS PutItemResponse
ReadS [PutItemResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutItemResponse]
$creadListPrec :: ReadPrec [PutItemResponse]
readPrec :: ReadPrec PutItemResponse
$creadPrec :: ReadPrec PutItemResponse
readList :: ReadS [PutItemResponse]
$creadList :: ReadS [PutItemResponse]
readsPrec :: Int -> ReadS PutItemResponse
$creadsPrec :: Int -> ReadS PutItemResponse
Prelude.Read, Int -> PutItemResponse -> ShowS
[PutItemResponse] -> ShowS
PutItemResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutItemResponse] -> ShowS
$cshowList :: [PutItemResponse] -> ShowS
show :: PutItemResponse -> String
$cshow :: PutItemResponse -> String
showsPrec :: Int -> PutItemResponse -> ShowS
$cshowsPrec :: Int -> PutItemResponse -> ShowS
Prelude.Show, forall x. Rep PutItemResponse x -> PutItemResponse
forall x. PutItemResponse -> Rep PutItemResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutItemResponse x -> PutItemResponse
$cfrom :: forall x. PutItemResponse -> Rep PutItemResponse x
Prelude.Generic)
newPutItemResponse ::
Prelude.Int ->
PutItemResponse
newPutItemResponse :: Int -> PutItemResponse
newPutItemResponse Int
pHttpStatus_ =
PutItemResponse'
{ $sel:attributes:PutItemResponse' :: Maybe (HashMap Text AttributeValue)
attributes = forall a. Maybe a
Prelude.Nothing,
$sel:consumedCapacity:PutItemResponse' :: Maybe ConsumedCapacity
consumedCapacity = forall a. Maybe a
Prelude.Nothing,
$sel:itemCollectionMetrics:PutItemResponse' :: Maybe ItemCollectionMetrics
itemCollectionMetrics = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutItemResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putItemResponse_attributes :: Lens.Lens' PutItemResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue))
putItemResponse_attributes :: Lens' PutItemResponse (Maybe (HashMap Text AttributeValue))
putItemResponse_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItemResponse' {Maybe (HashMap Text AttributeValue)
attributes :: Maybe (HashMap Text AttributeValue)
$sel:attributes:PutItemResponse' :: PutItemResponse -> Maybe (HashMap Text AttributeValue)
attributes} -> Maybe (HashMap Text AttributeValue)
attributes) (\s :: PutItemResponse
s@PutItemResponse' {} Maybe (HashMap Text AttributeValue)
a -> PutItemResponse
s {$sel:attributes:PutItemResponse' :: Maybe (HashMap Text AttributeValue)
attributes = Maybe (HashMap Text AttributeValue)
a} :: PutItemResponse) 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
putItemResponse_consumedCapacity :: Lens.Lens' PutItemResponse (Prelude.Maybe ConsumedCapacity)
putItemResponse_consumedCapacity :: Lens' PutItemResponse (Maybe ConsumedCapacity)
putItemResponse_consumedCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItemResponse' {Maybe ConsumedCapacity
consumedCapacity :: Maybe ConsumedCapacity
$sel:consumedCapacity:PutItemResponse' :: PutItemResponse -> Maybe ConsumedCapacity
consumedCapacity} -> Maybe ConsumedCapacity
consumedCapacity) (\s :: PutItemResponse
s@PutItemResponse' {} Maybe ConsumedCapacity
a -> PutItemResponse
s {$sel:consumedCapacity:PutItemResponse' :: Maybe ConsumedCapacity
consumedCapacity = Maybe ConsumedCapacity
a} :: PutItemResponse)
putItemResponse_itemCollectionMetrics :: Lens.Lens' PutItemResponse (Prelude.Maybe ItemCollectionMetrics)
putItemResponse_itemCollectionMetrics :: Lens' PutItemResponse (Maybe ItemCollectionMetrics)
putItemResponse_itemCollectionMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItemResponse' {Maybe ItemCollectionMetrics
itemCollectionMetrics :: Maybe ItemCollectionMetrics
$sel:itemCollectionMetrics:PutItemResponse' :: PutItemResponse -> Maybe ItemCollectionMetrics
itemCollectionMetrics} -> Maybe ItemCollectionMetrics
itemCollectionMetrics) (\s :: PutItemResponse
s@PutItemResponse' {} Maybe ItemCollectionMetrics
a -> PutItemResponse
s {$sel:itemCollectionMetrics:PutItemResponse' :: Maybe ItemCollectionMetrics
itemCollectionMetrics = Maybe ItemCollectionMetrics
a} :: PutItemResponse)
putItemResponse_httpStatus :: Lens.Lens' PutItemResponse Prelude.Int
putItemResponse_httpStatus :: Lens' PutItemResponse Int
putItemResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutItemResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutItemResponse' :: PutItemResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutItemResponse
s@PutItemResponse' {} Int
a -> PutItemResponse
s {$sel:httpStatus:PutItemResponse' :: Int
httpStatus = Int
a} :: PutItemResponse)
instance Prelude.NFData PutItemResponse where
rnf :: PutItemResponse -> ()
rnf PutItemResponse' {Int
Maybe (HashMap Text AttributeValue)
Maybe ItemCollectionMetrics
Maybe ConsumedCapacity
httpStatus :: Int
itemCollectionMetrics :: Maybe ItemCollectionMetrics
consumedCapacity :: Maybe ConsumedCapacity
attributes :: Maybe (HashMap Text AttributeValue)
$sel:httpStatus:PutItemResponse' :: PutItemResponse -> Int
$sel:itemCollectionMetrics:PutItemResponse' :: PutItemResponse -> Maybe ItemCollectionMetrics
$sel:consumedCapacity:PutItemResponse' :: PutItemResponse -> Maybe ConsumedCapacity
$sel:attributes:PutItemResponse' :: PutItemResponse -> Maybe (HashMap Text AttributeValue)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text AttributeValue)
attributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConsumedCapacity
consumedCapacity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ItemCollectionMetrics
itemCollectionMetrics
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus