{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DynamoDB.DeleteItem
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a single item in a table by primary key. You can perform a
-- conditional delete operation that deletes the item if it exists, or if
-- it has an expected attribute value.
--
-- In addition to deleting an item, you can also return the item\'s
-- attribute values in the same operation, using the @ReturnValues@
-- parameter.
--
-- Unless you specify conditions, the @DeleteItem@ is an idempotent
-- operation; running it multiple times on the same item or attribute does
-- /not/ result in an error response.
--
-- Conditional deletes are useful for deleting items only if specific
-- conditions are met. If those conditions are met, DynamoDB performs the
-- delete. Otherwise, the item is not deleted.
module Amazonka.DynamoDB.DeleteItem
  ( -- * Creating a Request
    DeleteItem (..),
    newDeleteItem,

    -- * Request Lenses
    deleteItem_expressionAttributeNames,
    deleteItem_returnValues,
    deleteItem_expressionAttributeValues,
    deleteItem_returnConsumedCapacity,
    deleteItem_returnItemCollectionMetrics,
    deleteItem_conditionExpression,
    deleteItem_conditionalOperator,
    deleteItem_expected,
    deleteItem_tableName,
    deleteItem_key,

    -- * Destructuring the Response
    DeleteItemResponse (..),
    newDeleteItemResponse,

    -- * Response Lenses
    deleteItemResponse_itemCollectionMetrics,
    deleteItemResponse_consumedCapacity,
    deleteItemResponse_attributes,
    deleteItemResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input of a @DeleteItem@ operation.
--
-- /See:/ 'newDeleteItem' smart constructor.
data DeleteItem = DeleteItem'
  { -- | One or more substitution tokens for attribute names in an expression.
    -- The following are some use cases for using @ExpressionAttributeNames@:
    --
    -- -   To access an attribute whose name conflicts with a DynamoDB reserved
    --     word.
    --
    -- -   To create a placeholder for repeating occurrences of an attribute
    --     name in an expression.
    --
    -- -   To prevent special characters in an attribute name from being
    --     misinterpreted in an expression.
    --
    -- Use the __#__ character in an expression to dereference an attribute
    -- name. For example, consider the following attribute name:
    --
    -- -   @Percentile@
    --
    -- The name of this attribute conflicts with a reserved word, so it cannot
    -- be used directly in an expression. (For the complete list of reserved
    -- words, see
    -- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html Reserved Words>
    -- in the /Amazon DynamoDB Developer Guide/). To work around this, you
    -- could specify the following for @ExpressionAttributeNames@:
    --
    -- -   @{\"#P\":\"Percentile\"}@
    --
    -- You could then use this substitution in an expression, as in this
    -- example:
    --
    -- -   @#P = :val@
    --
    -- Tokens that begin with the __:__ character are /expression attribute
    -- values/, which are placeholders for the actual value at runtime.
    --
    -- For more information on expression attribute names, see
    -- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html Specifying Item Attributes>
    -- in the /Amazon DynamoDB Developer Guide/.
    DeleteItem -> Maybe (HashMap Text Text)
expressionAttributeNames :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Use @ReturnValues@ if you want to get the item attributes as they
    -- appeared before they were deleted. For @DeleteItem@, the valid values
    -- are:
    --
    -- -   @NONE@ - If @ReturnValues@ is not specified, or if its value is
    --     @NONE@, then nothing is returned. (This setting is the default for
    --     @ReturnValues@.)
    --
    -- -   @ALL_OLD@ - The content of the old item is returned.
    --
    -- The @ReturnValues@ parameter is used by several DynamoDB operations;
    -- however, @DeleteItem@ does not recognize any values other than @NONE@ or
    -- @ALL_OLD@.
    DeleteItem -> Maybe ReturnValue
returnValues :: Prelude.Maybe ReturnValue,
    -- | One or more values that can be substituted in an expression.
    --
    -- Use the __:__ (colon) character in an expression to dereference an
    -- attribute value. For example, suppose that you wanted to check whether
    -- the value of the /ProductStatus/ attribute was one of the following:
    --
    -- @Available | Backordered | Discontinued@
    --
    -- You would first need to specify @ExpressionAttributeValues@ as follows:
    --
    -- @{ \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"}, \":disc\":{\"S\":\"Discontinued\"} }@
    --
    -- You could then use these values in an expression, such as this:
    --
    -- @ProductStatus IN (:avail, :back, :disc)@
    --
    -- For more information on expression attribute values, see
    -- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html Condition Expressions>
    -- in the /Amazon DynamoDB Developer Guide/.
    DeleteItem -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues :: Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue),
    DeleteItem -> Maybe ReturnConsumedCapacity
returnConsumedCapacity :: Prelude.Maybe ReturnConsumedCapacity,
    -- | Determines whether item collection metrics are returned. If set to
    -- @SIZE@, the response includes statistics about item collections, if any,
    -- that were modified during the operation are returned in the response. If
    -- set to @NONE@ (the default), no statistics are returned.
    DeleteItem -> Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics :: Prelude.Maybe ReturnItemCollectionMetrics,
    -- | A condition that must be satisfied in order for a conditional
    -- @DeleteItem@ to succeed.
    --
    -- An expression can contain any of the following:
    --
    -- -   Functions:
    --     @attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size@
    --
    --     These function names are case-sensitive.
    --
    -- -   Comparison operators: @= | \<> | \< | > | \<= | >= | BETWEEN | IN @
    --
    -- -   Logical operators: @AND | OR | NOT@
    --
    -- For more information about condition expressions, see
    -- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html Condition Expressions>
    -- in the /Amazon DynamoDB Developer Guide/.
    DeleteItem -> Maybe Text
conditionExpression :: Prelude.Maybe Prelude.Text,
    -- | This is a legacy parameter. Use @ConditionExpression@ instead. For more
    -- information, see
    -- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html ConditionalOperator>
    -- in the /Amazon DynamoDB Developer Guide/.
    DeleteItem -> Maybe ConditionalOperator
conditionalOperator :: Prelude.Maybe ConditionalOperator,
    -- | This is a legacy parameter. Use @ConditionExpression@ instead. For more
    -- information, see
    -- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html Expected>
    -- in the /Amazon DynamoDB Developer Guide/.
    DeleteItem -> Maybe (HashMap Text ExpectedAttributeValue)
expected :: Prelude.Maybe (Prelude.HashMap Prelude.Text ExpectedAttributeValue),
    -- | The name of the table from which to delete the item.
    DeleteItem -> Text
tableName :: Prelude.Text,
    -- | A map of attribute names to @AttributeValue@ objects, representing the
    -- primary key of the item to delete.
    --
    -- For the primary key, you must provide all of the attributes. For
    -- example, with a simple primary key, you only need to provide a value for
    -- the partition key. For a composite primary key, you must provide values
    -- for both the partition key and the sort key.
    DeleteItem -> HashMap Text AttributeValue
key :: Prelude.HashMap Prelude.Text AttributeValue
  }
  deriving (DeleteItem -> DeleteItem -> Bool
(DeleteItem -> DeleteItem -> Bool)
-> (DeleteItem -> DeleteItem -> Bool) -> Eq DeleteItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteItem -> DeleteItem -> Bool
$c/= :: DeleteItem -> DeleteItem -> Bool
== :: DeleteItem -> DeleteItem -> Bool
$c== :: DeleteItem -> DeleteItem -> Bool
Prelude.Eq, ReadPrec [DeleteItem]
ReadPrec DeleteItem
Int -> ReadS DeleteItem
ReadS [DeleteItem]
(Int -> ReadS DeleteItem)
-> ReadS [DeleteItem]
-> ReadPrec DeleteItem
-> ReadPrec [DeleteItem]
-> Read DeleteItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteItem]
$creadListPrec :: ReadPrec [DeleteItem]
readPrec :: ReadPrec DeleteItem
$creadPrec :: ReadPrec DeleteItem
readList :: ReadS [DeleteItem]
$creadList :: ReadS [DeleteItem]
readsPrec :: Int -> ReadS DeleteItem
$creadsPrec :: Int -> ReadS DeleteItem
Prelude.Read, Int -> DeleteItem -> ShowS
[DeleteItem] -> ShowS
DeleteItem -> String
(Int -> DeleteItem -> ShowS)
-> (DeleteItem -> String)
-> ([DeleteItem] -> ShowS)
-> Show DeleteItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteItem] -> ShowS
$cshowList :: [DeleteItem] -> ShowS
show :: DeleteItem -> String
$cshow :: DeleteItem -> String
showsPrec :: Int -> DeleteItem -> ShowS
$cshowsPrec :: Int -> DeleteItem -> ShowS
Prelude.Show, (forall x. DeleteItem -> Rep DeleteItem x)
-> (forall x. Rep DeleteItem x -> DeleteItem) -> Generic DeleteItem
forall x. Rep DeleteItem x -> DeleteItem
forall x. DeleteItem -> Rep DeleteItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteItem x -> DeleteItem
$cfrom :: forall x. DeleteItem -> Rep DeleteItem x
Prelude.Generic)

-- |
-- Create a value of 'DeleteItem' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'expressionAttributeNames', 'deleteItem_expressionAttributeNames' - One or more substitution tokens for attribute names in an expression.
-- The following are some use cases for using @ExpressionAttributeNames@:
--
-- -   To access an attribute whose name conflicts with a DynamoDB reserved
--     word.
--
-- -   To create a placeholder for repeating occurrences of an attribute
--     name in an expression.
--
-- -   To prevent special characters in an attribute name from being
--     misinterpreted in an expression.
--
-- Use the __#__ character in an expression to dereference an attribute
-- name. For example, consider the following attribute name:
--
-- -   @Percentile@
--
-- The name of this attribute conflicts with a reserved word, so it cannot
-- be used directly in an expression. (For the complete list of reserved
-- words, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html Reserved Words>
-- in the /Amazon DynamoDB Developer Guide/). To work around this, you
-- could specify the following for @ExpressionAttributeNames@:
--
-- -   @{\"#P\":\"Percentile\"}@
--
-- You could then use this substitution in an expression, as in this
-- example:
--
-- -   @#P = :val@
--
-- Tokens that begin with the __:__ character are /expression attribute
-- values/, which are placeholders for the actual value at runtime.
--
-- For more information on expression attribute names, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html Specifying Item Attributes>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- 'returnValues', 'deleteItem_returnValues' - Use @ReturnValues@ if you want to get the item attributes as they
-- appeared before they were deleted. For @DeleteItem@, the valid values
-- are:
--
-- -   @NONE@ - If @ReturnValues@ is not specified, or if its value is
--     @NONE@, then nothing is returned. (This setting is the default for
--     @ReturnValues@.)
--
-- -   @ALL_OLD@ - The content of the old item is returned.
--
-- The @ReturnValues@ parameter is used by several DynamoDB operations;
-- however, @DeleteItem@ does not recognize any values other than @NONE@ or
-- @ALL_OLD@.
--
-- 'expressionAttributeValues', 'deleteItem_expressionAttributeValues' - One or more values that can be substituted in an expression.
--
-- Use the __:__ (colon) character in an expression to dereference an
-- attribute value. For example, suppose that you wanted to check whether
-- the value of the /ProductStatus/ attribute was one of the following:
--
-- @Available | Backordered | Discontinued@
--
-- You would first need to specify @ExpressionAttributeValues@ as follows:
--
-- @{ \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"}, \":disc\":{\"S\":\"Discontinued\"} }@
--
-- You could then use these values in an expression, such as this:
--
-- @ProductStatus IN (:avail, :back, :disc)@
--
-- For more information on expression attribute values, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html Condition Expressions>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- 'returnConsumedCapacity', 'deleteItem_returnConsumedCapacity' - Undocumented member.
--
-- 'returnItemCollectionMetrics', 'deleteItem_returnItemCollectionMetrics' - Determines whether item collection metrics are returned. If set to
-- @SIZE@, the response includes statistics about item collections, if any,
-- that were modified during the operation are returned in the response. If
-- set to @NONE@ (the default), no statistics are returned.
--
-- 'conditionExpression', 'deleteItem_conditionExpression' - A condition that must be satisfied in order for a conditional
-- @DeleteItem@ to succeed.
--
-- An expression can contain any of the following:
--
-- -   Functions:
--     @attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size@
--
--     These function names are case-sensitive.
--
-- -   Comparison operators: @= | \<> | \< | > | \<= | >= | BETWEEN | IN @
--
-- -   Logical operators: @AND | OR | NOT@
--
-- For more information about condition expressions, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html Condition Expressions>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- 'conditionalOperator', 'deleteItem_conditionalOperator' - This is a legacy parameter. Use @ConditionExpression@ instead. For more
-- information, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html ConditionalOperator>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- 'expected', 'deleteItem_expected' - This is a legacy parameter. Use @ConditionExpression@ instead. For more
-- information, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html Expected>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- 'tableName', 'deleteItem_tableName' - The name of the table from which to delete the item.
--
-- 'key', 'deleteItem_key' - A map of attribute names to @AttributeValue@ objects, representing the
-- primary key of the item to delete.
--
-- For the primary key, you must provide all of the attributes. For
-- example, with a simple primary key, you only need to provide a value for
-- the partition key. For a composite primary key, you must provide values
-- for both the partition key and the sort key.
newDeleteItem ::
  -- | 'tableName'
  Prelude.Text ->
  DeleteItem
newDeleteItem :: Text -> DeleteItem
newDeleteItem Text
pTableName_ =
  DeleteItem' :: Maybe (HashMap Text Text)
-> Maybe ReturnValue
-> Maybe (HashMap Text AttributeValue)
-> Maybe ReturnConsumedCapacity
-> Maybe ReturnItemCollectionMetrics
-> Maybe Text
-> Maybe ConditionalOperator
-> Maybe (HashMap Text ExpectedAttributeValue)
-> Text
-> HashMap Text AttributeValue
-> DeleteItem
DeleteItem'
    { $sel:expressionAttributeNames:DeleteItem' :: Maybe (HashMap Text Text)
expressionAttributeNames =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:returnValues:DeleteItem' :: Maybe ReturnValue
returnValues = Maybe ReturnValue
forall a. Maybe a
Prelude.Nothing,
      $sel:expressionAttributeValues:DeleteItem' :: Maybe (HashMap Text AttributeValue)
expressionAttributeValues = Maybe (HashMap Text AttributeValue)
forall a. Maybe a
Prelude.Nothing,
      $sel:returnConsumedCapacity:DeleteItem' :: Maybe ReturnConsumedCapacity
returnConsumedCapacity = Maybe ReturnConsumedCapacity
forall a. Maybe a
Prelude.Nothing,
      $sel:returnItemCollectionMetrics:DeleteItem' :: Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics = Maybe ReturnItemCollectionMetrics
forall a. Maybe a
Prelude.Nothing,
      $sel:conditionExpression:DeleteItem' :: Maybe Text
conditionExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:conditionalOperator:DeleteItem' :: Maybe ConditionalOperator
conditionalOperator = Maybe ConditionalOperator
forall a. Maybe a
Prelude.Nothing,
      $sel:expected:DeleteItem' :: Maybe (HashMap Text ExpectedAttributeValue)
expected = Maybe (HashMap Text ExpectedAttributeValue)
forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:DeleteItem' :: Text
tableName = Text
pTableName_,
      $sel:key:DeleteItem' :: HashMap Text AttributeValue
key = HashMap Text AttributeValue
forall a. Monoid a => a
Prelude.mempty
    }

-- | One or more substitution tokens for attribute names in an expression.
-- The following are some use cases for using @ExpressionAttributeNames@:
--
-- -   To access an attribute whose name conflicts with a DynamoDB reserved
--     word.
--
-- -   To create a placeholder for repeating occurrences of an attribute
--     name in an expression.
--
-- -   To prevent special characters in an attribute name from being
--     misinterpreted in an expression.
--
-- Use the __#__ character in an expression to dereference an attribute
-- name. For example, consider the following attribute name:
--
-- -   @Percentile@
--
-- The name of this attribute conflicts with a reserved word, so it cannot
-- be used directly in an expression. (For the complete list of reserved
-- words, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html Reserved Words>
-- in the /Amazon DynamoDB Developer Guide/). To work around this, you
-- could specify the following for @ExpressionAttributeNames@:
--
-- -   @{\"#P\":\"Percentile\"}@
--
-- You could then use this substitution in an expression, as in this
-- example:
--
-- -   @#P = :val@
--
-- Tokens that begin with the __:__ character are /expression attribute
-- values/, which are placeholders for the actual value at runtime.
--
-- For more information on expression attribute names, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html Specifying Item Attributes>
-- in the /Amazon DynamoDB Developer Guide/.
deleteItem_expressionAttributeNames :: Lens.Lens' DeleteItem (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
deleteItem_expressionAttributeNames :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DeleteItem -> f DeleteItem
deleteItem_expressionAttributeNames = (DeleteItem -> Maybe (HashMap Text Text))
-> (DeleteItem -> Maybe (HashMap Text Text) -> DeleteItem)
-> Lens
     DeleteItem
     DeleteItem
     (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 (\DeleteItem' {Maybe (HashMap Text Text)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:expressionAttributeNames:DeleteItem' :: DeleteItem -> Maybe (HashMap Text Text)
expressionAttributeNames} -> Maybe (HashMap Text Text)
expressionAttributeNames) (\s :: DeleteItem
s@DeleteItem' {} Maybe (HashMap Text Text)
a -> DeleteItem
s {$sel:expressionAttributeNames:DeleteItem' :: Maybe (HashMap Text Text)
expressionAttributeNames = Maybe (HashMap Text Text)
a} :: DeleteItem) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> DeleteItem -> f DeleteItem)
-> ((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)))
-> DeleteItem
-> f DeleteItem
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

-- | Use @ReturnValues@ if you want to get the item attributes as they
-- appeared before they were deleted. For @DeleteItem@, the valid values
-- are:
--
-- -   @NONE@ - If @ReturnValues@ is not specified, or if its value is
--     @NONE@, then nothing is returned. (This setting is the default for
--     @ReturnValues@.)
--
-- -   @ALL_OLD@ - The content of the old item is returned.
--
-- The @ReturnValues@ parameter is used by several DynamoDB operations;
-- however, @DeleteItem@ does not recognize any values other than @NONE@ or
-- @ALL_OLD@.
deleteItem_returnValues :: Lens.Lens' DeleteItem (Prelude.Maybe ReturnValue)
deleteItem_returnValues :: (Maybe ReturnValue -> f (Maybe ReturnValue))
-> DeleteItem -> f DeleteItem
deleteItem_returnValues = (DeleteItem -> Maybe ReturnValue)
-> (DeleteItem -> Maybe ReturnValue -> DeleteItem)
-> Lens
     DeleteItem DeleteItem (Maybe ReturnValue) (Maybe ReturnValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItem' {Maybe ReturnValue
returnValues :: Maybe ReturnValue
$sel:returnValues:DeleteItem' :: DeleteItem -> Maybe ReturnValue
returnValues} -> Maybe ReturnValue
returnValues) (\s :: DeleteItem
s@DeleteItem' {} Maybe ReturnValue
a -> DeleteItem
s {$sel:returnValues:DeleteItem' :: Maybe ReturnValue
returnValues = Maybe ReturnValue
a} :: DeleteItem)

-- | One or more values that can be substituted in an expression.
--
-- Use the __:__ (colon) character in an expression to dereference an
-- attribute value. For example, suppose that you wanted to check whether
-- the value of the /ProductStatus/ attribute was one of the following:
--
-- @Available | Backordered | Discontinued@
--
-- You would first need to specify @ExpressionAttributeValues@ as follows:
--
-- @{ \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"}, \":disc\":{\"S\":\"Discontinued\"} }@
--
-- You could then use these values in an expression, such as this:
--
-- @ProductStatus IN (:avail, :back, :disc)@
--
-- For more information on expression attribute values, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html Condition Expressions>
-- in the /Amazon DynamoDB Developer Guide/.
deleteItem_expressionAttributeValues :: Lens.Lens' DeleteItem (Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue))
deleteItem_expressionAttributeValues :: (Maybe (HashMap Text AttributeValue)
 -> f (Maybe (HashMap Text AttributeValue)))
-> DeleteItem -> f DeleteItem
deleteItem_expressionAttributeValues = (DeleteItem -> Maybe (HashMap Text AttributeValue))
-> (DeleteItem
    -> Maybe (HashMap Text AttributeValue) -> DeleteItem)
-> Lens
     DeleteItem
     DeleteItem
     (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 (\DeleteItem' {Maybe (HashMap Text AttributeValue)
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
$sel:expressionAttributeValues:DeleteItem' :: DeleteItem -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues} -> Maybe (HashMap Text AttributeValue)
expressionAttributeValues) (\s :: DeleteItem
s@DeleteItem' {} Maybe (HashMap Text AttributeValue)
a -> DeleteItem
s {$sel:expressionAttributeValues:DeleteItem' :: Maybe (HashMap Text AttributeValue)
expressionAttributeValues = Maybe (HashMap Text AttributeValue)
a} :: DeleteItem) ((Maybe (HashMap Text AttributeValue)
  -> f (Maybe (HashMap Text AttributeValue)))
 -> DeleteItem -> f DeleteItem)
-> ((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)))
-> DeleteItem
-> f DeleteItem
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

-- | Undocumented member.
deleteItem_returnConsumedCapacity :: Lens.Lens' DeleteItem (Prelude.Maybe ReturnConsumedCapacity)
deleteItem_returnConsumedCapacity :: (Maybe ReturnConsumedCapacity -> f (Maybe ReturnConsumedCapacity))
-> DeleteItem -> f DeleteItem
deleteItem_returnConsumedCapacity = (DeleteItem -> Maybe ReturnConsumedCapacity)
-> (DeleteItem -> Maybe ReturnConsumedCapacity -> DeleteItem)
-> Lens
     DeleteItem
     DeleteItem
     (Maybe ReturnConsumedCapacity)
     (Maybe ReturnConsumedCapacity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItem' {Maybe ReturnConsumedCapacity
returnConsumedCapacity :: Maybe ReturnConsumedCapacity
$sel:returnConsumedCapacity:DeleteItem' :: DeleteItem -> Maybe ReturnConsumedCapacity
returnConsumedCapacity} -> Maybe ReturnConsumedCapacity
returnConsumedCapacity) (\s :: DeleteItem
s@DeleteItem' {} Maybe ReturnConsumedCapacity
a -> DeleteItem
s {$sel:returnConsumedCapacity:DeleteItem' :: Maybe ReturnConsumedCapacity
returnConsumedCapacity = Maybe ReturnConsumedCapacity
a} :: DeleteItem)

-- | Determines whether item collection metrics are returned. If set to
-- @SIZE@, the response includes statistics about item collections, if any,
-- that were modified during the operation are returned in the response. If
-- set to @NONE@ (the default), no statistics are returned.
deleteItem_returnItemCollectionMetrics :: Lens.Lens' DeleteItem (Prelude.Maybe ReturnItemCollectionMetrics)
deleteItem_returnItemCollectionMetrics :: (Maybe ReturnItemCollectionMetrics
 -> f (Maybe ReturnItemCollectionMetrics))
-> DeleteItem -> f DeleteItem
deleteItem_returnItemCollectionMetrics = (DeleteItem -> Maybe ReturnItemCollectionMetrics)
-> (DeleteItem -> Maybe ReturnItemCollectionMetrics -> DeleteItem)
-> Lens
     DeleteItem
     DeleteItem
     (Maybe ReturnItemCollectionMetrics)
     (Maybe ReturnItemCollectionMetrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItem' {Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics :: Maybe ReturnItemCollectionMetrics
$sel:returnItemCollectionMetrics:DeleteItem' :: DeleteItem -> Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics} -> Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics) (\s :: DeleteItem
s@DeleteItem' {} Maybe ReturnItemCollectionMetrics
a -> DeleteItem
s {$sel:returnItemCollectionMetrics:DeleteItem' :: Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics = Maybe ReturnItemCollectionMetrics
a} :: DeleteItem)

-- | A condition that must be satisfied in order for a conditional
-- @DeleteItem@ to succeed.
--
-- An expression can contain any of the following:
--
-- -   Functions:
--     @attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size@
--
--     These function names are case-sensitive.
--
-- -   Comparison operators: @= | \<> | \< | > | \<= | >= | BETWEEN | IN @
--
-- -   Logical operators: @AND | OR | NOT@
--
-- For more information about condition expressions, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html Condition Expressions>
-- in the /Amazon DynamoDB Developer Guide/.
deleteItem_conditionExpression :: Lens.Lens' DeleteItem (Prelude.Maybe Prelude.Text)
deleteItem_conditionExpression :: (Maybe Text -> f (Maybe Text)) -> DeleteItem -> f DeleteItem
deleteItem_conditionExpression = (DeleteItem -> Maybe Text)
-> (DeleteItem -> Maybe Text -> DeleteItem)
-> Lens DeleteItem DeleteItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItem' {Maybe Text
conditionExpression :: Maybe Text
$sel:conditionExpression:DeleteItem' :: DeleteItem -> Maybe Text
conditionExpression} -> Maybe Text
conditionExpression) (\s :: DeleteItem
s@DeleteItem' {} Maybe Text
a -> DeleteItem
s {$sel:conditionExpression:DeleteItem' :: Maybe Text
conditionExpression = Maybe Text
a} :: DeleteItem)

-- | This is a legacy parameter. Use @ConditionExpression@ instead. For more
-- information, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html ConditionalOperator>
-- in the /Amazon DynamoDB Developer Guide/.
deleteItem_conditionalOperator :: Lens.Lens' DeleteItem (Prelude.Maybe ConditionalOperator)
deleteItem_conditionalOperator :: (Maybe ConditionalOperator -> f (Maybe ConditionalOperator))
-> DeleteItem -> f DeleteItem
deleteItem_conditionalOperator = (DeleteItem -> Maybe ConditionalOperator)
-> (DeleteItem -> Maybe ConditionalOperator -> DeleteItem)
-> Lens
     DeleteItem
     DeleteItem
     (Maybe ConditionalOperator)
     (Maybe ConditionalOperator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItem' {Maybe ConditionalOperator
conditionalOperator :: Maybe ConditionalOperator
$sel:conditionalOperator:DeleteItem' :: DeleteItem -> Maybe ConditionalOperator
conditionalOperator} -> Maybe ConditionalOperator
conditionalOperator) (\s :: DeleteItem
s@DeleteItem' {} Maybe ConditionalOperator
a -> DeleteItem
s {$sel:conditionalOperator:DeleteItem' :: Maybe ConditionalOperator
conditionalOperator = Maybe ConditionalOperator
a} :: DeleteItem)

-- | This is a legacy parameter. Use @ConditionExpression@ instead. For more
-- information, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html Expected>
-- in the /Amazon DynamoDB Developer Guide/.
deleteItem_expected :: Lens.Lens' DeleteItem (Prelude.Maybe (Prelude.HashMap Prelude.Text ExpectedAttributeValue))
deleteItem_expected :: (Maybe (HashMap Text ExpectedAttributeValue)
 -> f (Maybe (HashMap Text ExpectedAttributeValue)))
-> DeleteItem -> f DeleteItem
deleteItem_expected = (DeleteItem -> Maybe (HashMap Text ExpectedAttributeValue))
-> (DeleteItem
    -> Maybe (HashMap Text ExpectedAttributeValue) -> DeleteItem)
-> Lens
     DeleteItem
     DeleteItem
     (Maybe (HashMap Text ExpectedAttributeValue))
     (Maybe (HashMap Text ExpectedAttributeValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItem' {Maybe (HashMap Text ExpectedAttributeValue)
expected :: Maybe (HashMap Text ExpectedAttributeValue)
$sel:expected:DeleteItem' :: DeleteItem -> Maybe (HashMap Text ExpectedAttributeValue)
expected} -> Maybe (HashMap Text ExpectedAttributeValue)
expected) (\s :: DeleteItem
s@DeleteItem' {} Maybe (HashMap Text ExpectedAttributeValue)
a -> DeleteItem
s {$sel:expected:DeleteItem' :: Maybe (HashMap Text ExpectedAttributeValue)
expected = Maybe (HashMap Text ExpectedAttributeValue)
a} :: DeleteItem) ((Maybe (HashMap Text ExpectedAttributeValue)
  -> f (Maybe (HashMap Text ExpectedAttributeValue)))
 -> DeleteItem -> f DeleteItem)
-> ((Maybe (HashMap Text ExpectedAttributeValue)
     -> f (Maybe (HashMap Text ExpectedAttributeValue)))
    -> Maybe (HashMap Text ExpectedAttributeValue)
    -> f (Maybe (HashMap Text ExpectedAttributeValue)))
-> (Maybe (HashMap Text ExpectedAttributeValue)
    -> f (Maybe (HashMap Text ExpectedAttributeValue)))
-> DeleteItem
-> f DeleteItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text ExpectedAttributeValue)
  (HashMap Text ExpectedAttributeValue)
  (HashMap Text ExpectedAttributeValue)
  (HashMap Text ExpectedAttributeValue)
-> Iso
     (Maybe (HashMap Text ExpectedAttributeValue))
     (Maybe (HashMap Text ExpectedAttributeValue))
     (Maybe (HashMap Text ExpectedAttributeValue))
     (Maybe (HashMap Text ExpectedAttributeValue))
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 ExpectedAttributeValue)
  (HashMap Text ExpectedAttributeValue)
  (HashMap Text ExpectedAttributeValue)
  (HashMap Text ExpectedAttributeValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the table from which to delete the item.
deleteItem_tableName :: Lens.Lens' DeleteItem Prelude.Text
deleteItem_tableName :: (Text -> f Text) -> DeleteItem -> f DeleteItem
deleteItem_tableName = (DeleteItem -> Text)
-> (DeleteItem -> Text -> DeleteItem)
-> Lens DeleteItem DeleteItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItem' {Text
tableName :: Text
$sel:tableName:DeleteItem' :: DeleteItem -> Text
tableName} -> Text
tableName) (\s :: DeleteItem
s@DeleteItem' {} Text
a -> DeleteItem
s {$sel:tableName:DeleteItem' :: Text
tableName = Text
a} :: DeleteItem)

-- | A map of attribute names to @AttributeValue@ objects, representing the
-- primary key of the item to delete.
--
-- For the primary key, you must provide all of the attributes. For
-- example, with a simple primary key, you only need to provide a value for
-- the partition key. For a composite primary key, you must provide values
-- for both the partition key and the sort key.
deleteItem_key :: Lens.Lens' DeleteItem (Prelude.HashMap Prelude.Text AttributeValue)
deleteItem_key :: (HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> DeleteItem -> f DeleteItem
deleteItem_key = (DeleteItem -> HashMap Text AttributeValue)
-> (DeleteItem -> HashMap Text AttributeValue -> DeleteItem)
-> Lens
     DeleteItem
     DeleteItem
     (HashMap Text AttributeValue)
     (HashMap Text AttributeValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItem' {HashMap Text AttributeValue
key :: HashMap Text AttributeValue
$sel:key:DeleteItem' :: DeleteItem -> HashMap Text AttributeValue
key} -> HashMap Text AttributeValue
key) (\s :: DeleteItem
s@DeleteItem' {} HashMap Text AttributeValue
a -> DeleteItem
s {$sel:key:DeleteItem' :: HashMap Text AttributeValue
key = HashMap Text AttributeValue
a} :: DeleteItem) ((HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
 -> DeleteItem -> f DeleteItem)
-> ((HashMap Text AttributeValue
     -> f (HashMap Text AttributeValue))
    -> HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> (HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> DeleteItem
-> f DeleteItem
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

instance Core.AWSRequest DeleteItem where
  type AWSResponse DeleteItem = DeleteItemResponse
  request :: DeleteItem -> Request DeleteItem
request = Service -> DeleteItem -> Request DeleteItem
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteItem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteItem)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteItem))
-> Logger
-> Service
-> Proxy DeleteItem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteItem)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ItemCollectionMetrics
-> Maybe ConsumedCapacity
-> Maybe (HashMap Text AttributeValue)
-> Int
-> DeleteItemResponse
DeleteItemResponse'
            (Maybe ItemCollectionMetrics
 -> Maybe ConsumedCapacity
 -> Maybe (HashMap Text AttributeValue)
 -> Int
 -> DeleteItemResponse)
-> Either String (Maybe ItemCollectionMetrics)
-> Either
     String
     (Maybe ConsumedCapacity
      -> Maybe (HashMap Text AttributeValue)
      -> Int
      -> DeleteItemResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ItemCollectionMetrics)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ItemCollectionMetrics")
            Either
  String
  (Maybe ConsumedCapacity
   -> Maybe (HashMap Text AttributeValue)
   -> Int
   -> DeleteItemResponse)
-> Either String (Maybe ConsumedCapacity)
-> Either
     String
     (Maybe (HashMap Text AttributeValue) -> Int -> DeleteItemResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ConsumedCapacity)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConsumedCapacity")
            Either
  String
  (Maybe (HashMap Text AttributeValue) -> Int -> DeleteItemResponse)
-> Either String (Maybe (HashMap Text AttributeValue))
-> Either String (Int -> DeleteItemResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Either String (Maybe (Maybe (HashMap Text AttributeValue)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Attributes" Either String (Maybe (Maybe (HashMap Text AttributeValue)))
-> Maybe (HashMap Text AttributeValue)
-> Either String (Maybe (HashMap Text AttributeValue))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text AttributeValue)
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> DeleteItemResponse)
-> Either String Int -> Either String DeleteItemResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteItem

instance Prelude.NFData DeleteItem

instance Core.ToHeaders DeleteItem where
  toHeaders :: DeleteItem -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteItem -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DynamoDB_20120810.DeleteItem" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteItem where
  toJSON :: DeleteItem -> Value
toJSON DeleteItem' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text AttributeValue)
Maybe (HashMap Text ExpectedAttributeValue)
Maybe ConditionalOperator
Maybe ReturnConsumedCapacity
Maybe ReturnItemCollectionMetrics
Maybe ReturnValue
Text
HashMap Text AttributeValue
key :: HashMap Text AttributeValue
tableName :: Text
expected :: Maybe (HashMap Text ExpectedAttributeValue)
conditionalOperator :: Maybe ConditionalOperator
conditionExpression :: Maybe Text
returnItemCollectionMetrics :: Maybe ReturnItemCollectionMetrics
returnConsumedCapacity :: Maybe ReturnConsumedCapacity
expressionAttributeValues :: Maybe (HashMap Text AttributeValue)
returnValues :: Maybe ReturnValue
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:key:DeleteItem' :: DeleteItem -> HashMap Text AttributeValue
$sel:tableName:DeleteItem' :: DeleteItem -> Text
$sel:expected:DeleteItem' :: DeleteItem -> Maybe (HashMap Text ExpectedAttributeValue)
$sel:conditionalOperator:DeleteItem' :: DeleteItem -> Maybe ConditionalOperator
$sel:conditionExpression:DeleteItem' :: DeleteItem -> Maybe Text
$sel:returnItemCollectionMetrics:DeleteItem' :: DeleteItem -> Maybe ReturnItemCollectionMetrics
$sel:returnConsumedCapacity:DeleteItem' :: DeleteItem -> Maybe ReturnConsumedCapacity
$sel:expressionAttributeValues:DeleteItem' :: DeleteItem -> Maybe (HashMap Text AttributeValue)
$sel:returnValues:DeleteItem' :: DeleteItem -> Maybe ReturnValue
$sel:expressionAttributeNames:DeleteItem' :: DeleteItem -> 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
"ReturnValues" Text -> ReturnValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ReturnValue -> Pair) -> Maybe ReturnValue -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReturnValue
returnValues,
            (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
"ReturnConsumedCapacity" Text -> ReturnConsumedCapacity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReturnConsumedCapacity -> Pair)
-> Maybe ReturnConsumedCapacity -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReturnConsumedCapacity
returnConsumedCapacity,
            (Text
"ReturnItemCollectionMetrics" Text -> ReturnItemCollectionMetrics -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReturnItemCollectionMetrics -> Pair)
-> Maybe ReturnItemCollectionMetrics -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReturnItemCollectionMetrics
returnItemCollectionMetrics,
            (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,
            (Text
"ConditionalOperator" Text -> ConditionalOperator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConditionalOperator -> Pair)
-> Maybe ConditionalOperator -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConditionalOperator
conditionalOperator,
            (Text
"Expected" Text -> HashMap Text ExpectedAttributeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text ExpectedAttributeValue -> Pair)
-> Maybe (HashMap Text ExpectedAttributeValue) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text ExpectedAttributeValue)
expected,
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> HashMap Text AttributeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text AttributeValue
key)
          ]
      )

instance Core.ToPath DeleteItem where
  toPath :: DeleteItem -> ByteString
toPath = ByteString -> DeleteItem -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteItem where
  toQuery :: DeleteItem -> QueryString
toQuery = QueryString -> DeleteItem -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | Represents the output of a @DeleteItem@ operation.
--
-- /See:/ 'newDeleteItemResponse' smart constructor.
data DeleteItemResponse = DeleteItemResponse'
  { -- | Information about item collections, if any, that were affected by the
    -- @DeleteItem@ operation. @ItemCollectionMetrics@ is only returned if the
    -- @ReturnItemCollectionMetrics@ parameter was specified. If the table does
    -- not have any local secondary indexes, this information is not returned
    -- in the response.
    --
    -- Each @ItemCollectionMetrics@ element consists of:
    --
    -- -   @ItemCollectionKey@ - The partition key value of the item
    --     collection. This is the same as the partition key value of the item
    --     itself.
    --
    -- -   @SizeEstimateRangeGB@ - An estimate of item collection size, in
    --     gigabytes. This value is a two-element array containing a lower
    --     bound and an upper bound for the estimate. The estimate includes the
    --     size of all the items in the table, plus the size of all attributes
    --     projected into all of the local secondary indexes on that table. Use
    --     this estimate to measure whether a local secondary index is
    --     approaching its size limit.
    --
    --     The estimate is subject to change over time; therefore, do not rely
    --     on the precision or accuracy of the estimate.
    DeleteItemResponse -> Maybe ItemCollectionMetrics
itemCollectionMetrics :: Prelude.Maybe ItemCollectionMetrics,
    -- | The capacity units consumed by the @DeleteItem@ operation. The data
    -- returned includes the total provisioned throughput consumed, along with
    -- statistics for the table and any indexes involved in the operation.
    -- @ConsumedCapacity@ is only returned if the @ReturnConsumedCapacity@
    -- parameter was specified. For more information, see
    -- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ProvisionedThroughputIntro.html Provisioned Mode>
    -- in the /Amazon DynamoDB Developer Guide/.
    DeleteItemResponse -> Maybe ConsumedCapacity
consumedCapacity :: Prelude.Maybe ConsumedCapacity,
    -- | A map of attribute names to @AttributeValue@ objects, representing the
    -- item as it appeared before the @DeleteItem@ operation. This map appears
    -- in the response only if @ReturnValues@ was specified as @ALL_OLD@ in the
    -- request.
    DeleteItemResponse -> Maybe (HashMap Text AttributeValue)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue),
    -- | The response's http status code.
    DeleteItemResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteItemResponse -> DeleteItemResponse -> Bool
(DeleteItemResponse -> DeleteItemResponse -> Bool)
-> (DeleteItemResponse -> DeleteItemResponse -> Bool)
-> Eq DeleteItemResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteItemResponse -> DeleteItemResponse -> Bool
$c/= :: DeleteItemResponse -> DeleteItemResponse -> Bool
== :: DeleteItemResponse -> DeleteItemResponse -> Bool
$c== :: DeleteItemResponse -> DeleteItemResponse -> Bool
Prelude.Eq, ReadPrec [DeleteItemResponse]
ReadPrec DeleteItemResponse
Int -> ReadS DeleteItemResponse
ReadS [DeleteItemResponse]
(Int -> ReadS DeleteItemResponse)
-> ReadS [DeleteItemResponse]
-> ReadPrec DeleteItemResponse
-> ReadPrec [DeleteItemResponse]
-> Read DeleteItemResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteItemResponse]
$creadListPrec :: ReadPrec [DeleteItemResponse]
readPrec :: ReadPrec DeleteItemResponse
$creadPrec :: ReadPrec DeleteItemResponse
readList :: ReadS [DeleteItemResponse]
$creadList :: ReadS [DeleteItemResponse]
readsPrec :: Int -> ReadS DeleteItemResponse
$creadsPrec :: Int -> ReadS DeleteItemResponse
Prelude.Read, Int -> DeleteItemResponse -> ShowS
[DeleteItemResponse] -> ShowS
DeleteItemResponse -> String
(Int -> DeleteItemResponse -> ShowS)
-> (DeleteItemResponse -> String)
-> ([DeleteItemResponse] -> ShowS)
-> Show DeleteItemResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteItemResponse] -> ShowS
$cshowList :: [DeleteItemResponse] -> ShowS
show :: DeleteItemResponse -> String
$cshow :: DeleteItemResponse -> String
showsPrec :: Int -> DeleteItemResponse -> ShowS
$cshowsPrec :: Int -> DeleteItemResponse -> ShowS
Prelude.Show, (forall x. DeleteItemResponse -> Rep DeleteItemResponse x)
-> (forall x. Rep DeleteItemResponse x -> DeleteItemResponse)
-> Generic DeleteItemResponse
forall x. Rep DeleteItemResponse x -> DeleteItemResponse
forall x. DeleteItemResponse -> Rep DeleteItemResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteItemResponse x -> DeleteItemResponse
$cfrom :: forall x. DeleteItemResponse -> Rep DeleteItemResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteItemResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'itemCollectionMetrics', 'deleteItemResponse_itemCollectionMetrics' - Information about item collections, if any, that were affected by the
-- @DeleteItem@ operation. @ItemCollectionMetrics@ is only returned if the
-- @ReturnItemCollectionMetrics@ parameter was specified. If the table does
-- not have any local secondary indexes, this information is not returned
-- in the response.
--
-- Each @ItemCollectionMetrics@ element consists of:
--
-- -   @ItemCollectionKey@ - The partition key value of the item
--     collection. This is the same as the partition key value of the item
--     itself.
--
-- -   @SizeEstimateRangeGB@ - An estimate of item collection size, in
--     gigabytes. This value is a two-element array containing a lower
--     bound and an upper bound for the estimate. The estimate includes the
--     size of all the items in the table, plus the size of all attributes
--     projected into all of the local secondary indexes on that table. Use
--     this estimate to measure whether a local secondary index is
--     approaching its size limit.
--
--     The estimate is subject to change over time; therefore, do not rely
--     on the precision or accuracy of the estimate.
--
-- 'consumedCapacity', 'deleteItemResponse_consumedCapacity' - The capacity units consumed by the @DeleteItem@ operation. The data
-- returned includes the total provisioned throughput consumed, along with
-- statistics for the table and any indexes involved in the operation.
-- @ConsumedCapacity@ is only returned if the @ReturnConsumedCapacity@
-- parameter was specified. For more information, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ProvisionedThroughputIntro.html Provisioned Mode>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- 'attributes', 'deleteItemResponse_attributes' - A map of attribute names to @AttributeValue@ objects, representing the
-- item as it appeared before the @DeleteItem@ operation. This map appears
-- in the response only if @ReturnValues@ was specified as @ALL_OLD@ in the
-- request.
--
-- 'httpStatus', 'deleteItemResponse_httpStatus' - The response's http status code.
newDeleteItemResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteItemResponse
newDeleteItemResponse :: Int -> DeleteItemResponse
newDeleteItemResponse Int
pHttpStatus_ =
  DeleteItemResponse' :: Maybe ItemCollectionMetrics
-> Maybe ConsumedCapacity
-> Maybe (HashMap Text AttributeValue)
-> Int
-> DeleteItemResponse
DeleteItemResponse'
    { $sel:itemCollectionMetrics:DeleteItemResponse' :: Maybe ItemCollectionMetrics
itemCollectionMetrics =
        Maybe ItemCollectionMetrics
forall a. Maybe a
Prelude.Nothing,
      $sel:consumedCapacity:DeleteItemResponse' :: Maybe ConsumedCapacity
consumedCapacity = Maybe ConsumedCapacity
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:DeleteItemResponse' :: Maybe (HashMap Text AttributeValue)
attributes = Maybe (HashMap Text AttributeValue)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteItemResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about item collections, if any, that were affected by the
-- @DeleteItem@ operation. @ItemCollectionMetrics@ is only returned if the
-- @ReturnItemCollectionMetrics@ parameter was specified. If the table does
-- not have any local secondary indexes, this information is not returned
-- in the response.
--
-- Each @ItemCollectionMetrics@ element consists of:
--
-- -   @ItemCollectionKey@ - The partition key value of the item
--     collection. This is the same as the partition key value of the item
--     itself.
--
-- -   @SizeEstimateRangeGB@ - An estimate of item collection size, in
--     gigabytes. This value is a two-element array containing a lower
--     bound and an upper bound for the estimate. The estimate includes the
--     size of all the items in the table, plus the size of all attributes
--     projected into all of the local secondary indexes on that table. Use
--     this estimate to measure whether a local secondary index is
--     approaching its size limit.
--
--     The estimate is subject to change over time; therefore, do not rely
--     on the precision or accuracy of the estimate.
deleteItemResponse_itemCollectionMetrics :: Lens.Lens' DeleteItemResponse (Prelude.Maybe ItemCollectionMetrics)
deleteItemResponse_itemCollectionMetrics :: (Maybe ItemCollectionMetrics -> f (Maybe ItemCollectionMetrics))
-> DeleteItemResponse -> f DeleteItemResponse
deleteItemResponse_itemCollectionMetrics = (DeleteItemResponse -> Maybe ItemCollectionMetrics)
-> (DeleteItemResponse
    -> Maybe ItemCollectionMetrics -> DeleteItemResponse)
-> Lens
     DeleteItemResponse
     DeleteItemResponse
     (Maybe ItemCollectionMetrics)
     (Maybe ItemCollectionMetrics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItemResponse' {Maybe ItemCollectionMetrics
itemCollectionMetrics :: Maybe ItemCollectionMetrics
$sel:itemCollectionMetrics:DeleteItemResponse' :: DeleteItemResponse -> Maybe ItemCollectionMetrics
itemCollectionMetrics} -> Maybe ItemCollectionMetrics
itemCollectionMetrics) (\s :: DeleteItemResponse
s@DeleteItemResponse' {} Maybe ItemCollectionMetrics
a -> DeleteItemResponse
s {$sel:itemCollectionMetrics:DeleteItemResponse' :: Maybe ItemCollectionMetrics
itemCollectionMetrics = Maybe ItemCollectionMetrics
a} :: DeleteItemResponse)

-- | The capacity units consumed by the @DeleteItem@ operation. The data
-- returned includes the total provisioned throughput consumed, along with
-- statistics for the table and any indexes involved in the operation.
-- @ConsumedCapacity@ is only returned if the @ReturnConsumedCapacity@
-- parameter was specified. For more information, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ProvisionedThroughputIntro.html Provisioned Mode>
-- in the /Amazon DynamoDB Developer Guide/.
deleteItemResponse_consumedCapacity :: Lens.Lens' DeleteItemResponse (Prelude.Maybe ConsumedCapacity)
deleteItemResponse_consumedCapacity :: (Maybe ConsumedCapacity -> f (Maybe ConsumedCapacity))
-> DeleteItemResponse -> f DeleteItemResponse
deleteItemResponse_consumedCapacity = (DeleteItemResponse -> Maybe ConsumedCapacity)
-> (DeleteItemResponse
    -> Maybe ConsumedCapacity -> DeleteItemResponse)
-> Lens
     DeleteItemResponse
     DeleteItemResponse
     (Maybe ConsumedCapacity)
     (Maybe ConsumedCapacity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItemResponse' {Maybe ConsumedCapacity
consumedCapacity :: Maybe ConsumedCapacity
$sel:consumedCapacity:DeleteItemResponse' :: DeleteItemResponse -> Maybe ConsumedCapacity
consumedCapacity} -> Maybe ConsumedCapacity
consumedCapacity) (\s :: DeleteItemResponse
s@DeleteItemResponse' {} Maybe ConsumedCapacity
a -> DeleteItemResponse
s {$sel:consumedCapacity:DeleteItemResponse' :: Maybe ConsumedCapacity
consumedCapacity = Maybe ConsumedCapacity
a} :: DeleteItemResponse)

-- | A map of attribute names to @AttributeValue@ objects, representing the
-- item as it appeared before the @DeleteItem@ operation. This map appears
-- in the response only if @ReturnValues@ was specified as @ALL_OLD@ in the
-- request.
deleteItemResponse_attributes :: Lens.Lens' DeleteItemResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text AttributeValue))
deleteItemResponse_attributes :: (Maybe (HashMap Text AttributeValue)
 -> f (Maybe (HashMap Text AttributeValue)))
-> DeleteItemResponse -> f DeleteItemResponse
deleteItemResponse_attributes = (DeleteItemResponse -> Maybe (HashMap Text AttributeValue))
-> (DeleteItemResponse
    -> Maybe (HashMap Text AttributeValue) -> DeleteItemResponse)
-> Lens
     DeleteItemResponse
     DeleteItemResponse
     (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 (\DeleteItemResponse' {Maybe (HashMap Text AttributeValue)
attributes :: Maybe (HashMap Text AttributeValue)
$sel:attributes:DeleteItemResponse' :: DeleteItemResponse -> Maybe (HashMap Text AttributeValue)
attributes} -> Maybe (HashMap Text AttributeValue)
attributes) (\s :: DeleteItemResponse
s@DeleteItemResponse' {} Maybe (HashMap Text AttributeValue)
a -> DeleteItemResponse
s {$sel:attributes:DeleteItemResponse' :: Maybe (HashMap Text AttributeValue)
attributes = Maybe (HashMap Text AttributeValue)
a} :: DeleteItemResponse) ((Maybe (HashMap Text AttributeValue)
  -> f (Maybe (HashMap Text AttributeValue)))
 -> DeleteItemResponse -> f DeleteItemResponse)
-> ((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)))
-> DeleteItemResponse
-> f DeleteItemResponse
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

-- | The response's http status code.
deleteItemResponse_httpStatus :: Lens.Lens' DeleteItemResponse Prelude.Int
deleteItemResponse_httpStatus :: (Int -> f Int) -> DeleteItemResponse -> f DeleteItemResponse
deleteItemResponse_httpStatus = (DeleteItemResponse -> Int)
-> (DeleteItemResponse -> Int -> DeleteItemResponse)
-> Lens DeleteItemResponse DeleteItemResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteItemResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteItemResponse' :: DeleteItemResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteItemResponse
s@DeleteItemResponse' {} Int
a -> DeleteItemResponse
s {$sel:httpStatus:DeleteItemResponse' :: Int
httpStatus = Int
a} :: DeleteItemResponse)

instance Prelude.NFData DeleteItemResponse