{-# 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.DeleteTable
(
DeleteTable (..),
newDeleteTable,
deleteTable_tableName,
DeleteTableResponse (..),
newDeleteTableResponse,
deleteTableResponse_tableDescription,
deleteTableResponse_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
data DeleteTable = DeleteTable'
{
DeleteTable -> Text
tableName :: Prelude.Text
}
deriving (DeleteTable -> DeleteTable -> Bool
(DeleteTable -> DeleteTable -> Bool)
-> (DeleteTable -> DeleteTable -> Bool) -> Eq DeleteTable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTable -> DeleteTable -> Bool
$c/= :: DeleteTable -> DeleteTable -> Bool
== :: DeleteTable -> DeleteTable -> Bool
$c== :: DeleteTable -> DeleteTable -> Bool
Prelude.Eq, ReadPrec [DeleteTable]
ReadPrec DeleteTable
Int -> ReadS DeleteTable
ReadS [DeleteTable]
(Int -> ReadS DeleteTable)
-> ReadS [DeleteTable]
-> ReadPrec DeleteTable
-> ReadPrec [DeleteTable]
-> Read DeleteTable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTable]
$creadListPrec :: ReadPrec [DeleteTable]
readPrec :: ReadPrec DeleteTable
$creadPrec :: ReadPrec DeleteTable
readList :: ReadS [DeleteTable]
$creadList :: ReadS [DeleteTable]
readsPrec :: Int -> ReadS DeleteTable
$creadsPrec :: Int -> ReadS DeleteTable
Prelude.Read, Int -> DeleteTable -> ShowS
[DeleteTable] -> ShowS
DeleteTable -> String
(Int -> DeleteTable -> ShowS)
-> (DeleteTable -> String)
-> ([DeleteTable] -> ShowS)
-> Show DeleteTable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTable] -> ShowS
$cshowList :: [DeleteTable] -> ShowS
show :: DeleteTable -> String
$cshow :: DeleteTable -> String
showsPrec :: Int -> DeleteTable -> ShowS
$cshowsPrec :: Int -> DeleteTable -> ShowS
Prelude.Show, (forall x. DeleteTable -> Rep DeleteTable x)
-> (forall x. Rep DeleteTable x -> DeleteTable)
-> Generic DeleteTable
forall x. Rep DeleteTable x -> DeleteTable
forall x. DeleteTable -> Rep DeleteTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTable x -> DeleteTable
$cfrom :: forall x. DeleteTable -> Rep DeleteTable x
Prelude.Generic)
newDeleteTable ::
Prelude.Text ->
DeleteTable
newDeleteTable :: Text -> DeleteTable
newDeleteTable Text
pTableName_ =
DeleteTable' :: Text -> DeleteTable
DeleteTable' {$sel:tableName:DeleteTable' :: Text
tableName = Text
pTableName_}
deleteTable_tableName :: Lens.Lens' DeleteTable Prelude.Text
deleteTable_tableName :: (Text -> f Text) -> DeleteTable -> f DeleteTable
deleteTable_tableName = (DeleteTable -> Text)
-> (DeleteTable -> Text -> DeleteTable)
-> Lens DeleteTable DeleteTable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTable' {Text
tableName :: Text
$sel:tableName:DeleteTable' :: DeleteTable -> Text
tableName} -> Text
tableName) (\s :: DeleteTable
s@DeleteTable' {} Text
a -> DeleteTable
s {$sel:tableName:DeleteTable' :: Text
tableName = Text
a} :: DeleteTable)
instance Core.AWSRequest DeleteTable where
type AWSResponse DeleteTable = DeleteTableResponse
request :: DeleteTable -> Request DeleteTable
request = Service -> DeleteTable -> Request DeleteTable
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteTable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTable)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteTable))
-> Logger
-> Service
-> Proxy DeleteTable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTable)))
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 TableDescription -> Int -> DeleteTableResponse
DeleteTableResponse'
(Maybe TableDescription -> Int -> DeleteTableResponse)
-> Either String (Maybe TableDescription)
-> Either String (Int -> DeleteTableResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe TableDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TableDescription")
Either String (Int -> DeleteTableResponse)
-> Either String Int -> Either String DeleteTableResponse
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 DeleteTable
instance Prelude.NFData DeleteTable
instance Core.ToHeaders DeleteTable where
toHeaders :: DeleteTable -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteTable -> 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.DeleteTable" ::
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 DeleteTable where
toJSON :: DeleteTable -> Value
toJSON DeleteTable' {Text
tableName :: Text
$sel:tableName:DeleteTable' :: DeleteTable -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[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)]
)
instance Core.ToPath DeleteTable where
toPath :: DeleteTable -> ByteString
toPath = ByteString -> DeleteTable -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteTable where
toQuery :: DeleteTable -> QueryString
toQuery = QueryString -> DeleteTable -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteTableResponse = DeleteTableResponse'
{
DeleteTableResponse -> Maybe TableDescription
tableDescription :: Prelude.Maybe TableDescription,
DeleteTableResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteTableResponse -> DeleteTableResponse -> Bool
(DeleteTableResponse -> DeleteTableResponse -> Bool)
-> (DeleteTableResponse -> DeleteTableResponse -> Bool)
-> Eq DeleteTableResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTableResponse -> DeleteTableResponse -> Bool
$c/= :: DeleteTableResponse -> DeleteTableResponse -> Bool
== :: DeleteTableResponse -> DeleteTableResponse -> Bool
$c== :: DeleteTableResponse -> DeleteTableResponse -> Bool
Prelude.Eq, ReadPrec [DeleteTableResponse]
ReadPrec DeleteTableResponse
Int -> ReadS DeleteTableResponse
ReadS [DeleteTableResponse]
(Int -> ReadS DeleteTableResponse)
-> ReadS [DeleteTableResponse]
-> ReadPrec DeleteTableResponse
-> ReadPrec [DeleteTableResponse]
-> Read DeleteTableResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTableResponse]
$creadListPrec :: ReadPrec [DeleteTableResponse]
readPrec :: ReadPrec DeleteTableResponse
$creadPrec :: ReadPrec DeleteTableResponse
readList :: ReadS [DeleteTableResponse]
$creadList :: ReadS [DeleteTableResponse]
readsPrec :: Int -> ReadS DeleteTableResponse
$creadsPrec :: Int -> ReadS DeleteTableResponse
Prelude.Read, Int -> DeleteTableResponse -> ShowS
[DeleteTableResponse] -> ShowS
DeleteTableResponse -> String
(Int -> DeleteTableResponse -> ShowS)
-> (DeleteTableResponse -> String)
-> ([DeleteTableResponse] -> ShowS)
-> Show DeleteTableResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTableResponse] -> ShowS
$cshowList :: [DeleteTableResponse] -> ShowS
show :: DeleteTableResponse -> String
$cshow :: DeleteTableResponse -> String
showsPrec :: Int -> DeleteTableResponse -> ShowS
$cshowsPrec :: Int -> DeleteTableResponse -> ShowS
Prelude.Show, (forall x. DeleteTableResponse -> Rep DeleteTableResponse x)
-> (forall x. Rep DeleteTableResponse x -> DeleteTableResponse)
-> Generic DeleteTableResponse
forall x. Rep DeleteTableResponse x -> DeleteTableResponse
forall x. DeleteTableResponse -> Rep DeleteTableResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTableResponse x -> DeleteTableResponse
$cfrom :: forall x. DeleteTableResponse -> Rep DeleteTableResponse x
Prelude.Generic)
newDeleteTableResponse ::
Prelude.Int ->
DeleteTableResponse
newDeleteTableResponse :: Int -> DeleteTableResponse
newDeleteTableResponse Int
pHttpStatus_ =
DeleteTableResponse' :: Maybe TableDescription -> Int -> DeleteTableResponse
DeleteTableResponse'
{ $sel:tableDescription:DeleteTableResponse' :: Maybe TableDescription
tableDescription =
Maybe TableDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteTableResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteTableResponse_tableDescription :: Lens.Lens' DeleteTableResponse (Prelude.Maybe TableDescription)
deleteTableResponse_tableDescription :: (Maybe TableDescription -> f (Maybe TableDescription))
-> DeleteTableResponse -> f DeleteTableResponse
deleteTableResponse_tableDescription = (DeleteTableResponse -> Maybe TableDescription)
-> (DeleteTableResponse
-> Maybe TableDescription -> DeleteTableResponse)
-> Lens
DeleteTableResponse
DeleteTableResponse
(Maybe TableDescription)
(Maybe TableDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTableResponse' {Maybe TableDescription
tableDescription :: Maybe TableDescription
$sel:tableDescription:DeleteTableResponse' :: DeleteTableResponse -> Maybe TableDescription
tableDescription} -> Maybe TableDescription
tableDescription) (\s :: DeleteTableResponse
s@DeleteTableResponse' {} Maybe TableDescription
a -> DeleteTableResponse
s {$sel:tableDescription:DeleteTableResponse' :: Maybe TableDescription
tableDescription = Maybe TableDescription
a} :: DeleteTableResponse)
deleteTableResponse_httpStatus :: Lens.Lens' DeleteTableResponse Prelude.Int
deleteTableResponse_httpStatus :: (Int -> f Int) -> DeleteTableResponse -> f DeleteTableResponse
deleteTableResponse_httpStatus = (DeleteTableResponse -> Int)
-> (DeleteTableResponse -> Int -> DeleteTableResponse)
-> Lens DeleteTableResponse DeleteTableResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTableResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteTableResponse' :: DeleteTableResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteTableResponse
s@DeleteTableResponse' {} Int
a -> DeleteTableResponse
s {$sel:httpStatus:DeleteTableResponse' :: Int
httpStatus = Int
a} :: DeleteTableResponse)
instance Prelude.NFData DeleteTableResponse