{-# 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.Glue.DeleteTable
(
DeleteTable (..),
newDeleteTable,
deleteTable_catalogId,
deleteTable_databaseName,
deleteTable_name,
DeleteTableResponse (..),
newDeleteTableResponse,
deleteTableResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Glue.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 -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
DeleteTable -> Text
databaseName :: Prelude.Text,
DeleteTable -> Text
name :: 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 ->
Prelude.Text ->
DeleteTable
newDeleteTable :: Text -> Text -> DeleteTable
newDeleteTable Text
pDatabaseName_ Text
pName_ =
DeleteTable' :: Maybe Text -> Text -> Text -> DeleteTable
DeleteTable'
{ $sel:catalogId:DeleteTable' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:DeleteTable' :: Text
databaseName = Text
pDatabaseName_,
$sel:name:DeleteTable' :: Text
name = Text
pName_
}
deleteTable_catalogId :: Lens.Lens' DeleteTable (Prelude.Maybe Prelude.Text)
deleteTable_catalogId :: (Maybe Text -> f (Maybe Text)) -> DeleteTable -> f DeleteTable
deleteTable_catalogId = (DeleteTable -> Maybe Text)
-> (DeleteTable -> Maybe Text -> DeleteTable)
-> Lens DeleteTable DeleteTable (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTable' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:DeleteTable' :: DeleteTable -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: DeleteTable
s@DeleteTable' {} Maybe Text
a -> DeleteTable
s {$sel:catalogId:DeleteTable' :: Maybe Text
catalogId = Maybe Text
a} :: DeleteTable)
deleteTable_databaseName :: Lens.Lens' DeleteTable Prelude.Text
deleteTable_databaseName :: (Text -> f Text) -> DeleteTable -> f DeleteTable
deleteTable_databaseName = (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
databaseName :: Text
$sel:databaseName:DeleteTable' :: DeleteTable -> Text
databaseName} -> Text
databaseName) (\s :: DeleteTable
s@DeleteTable' {} Text
a -> DeleteTable
s {$sel:databaseName:DeleteTable' :: Text
databaseName = Text
a} :: DeleteTable)
deleteTable_name :: Lens.Lens' DeleteTable Prelude.Text
deleteTable_name :: (Text -> f Text) -> DeleteTable -> f DeleteTable
deleteTable_name = (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
name :: Text
$sel:name:DeleteTable' :: DeleteTable -> Text
name} -> Text
name) (\s :: DeleteTable
s@DeleteTable' {} Text
a -> DeleteTable
s {$sel:name:DeleteTable' :: Text
name = 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
-> ()
-> Either String (AWSResponse DeleteTable))
-> Logger
-> Service
-> Proxy DeleteTable
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTable)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> DeleteTableResponse
DeleteTableResponse'
(Int -> DeleteTableResponse)
-> Either String Int -> Either String DeleteTableResponse
forall (f :: * -> *) a b. Functor 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
"AWSGlue.DeleteTable" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DeleteTable where
toJSON :: DeleteTable -> Value
toJSON DeleteTable' {Maybe Text
Text
name :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:name:DeleteTable' :: DeleteTable -> Text
$sel:databaseName:DeleteTable' :: DeleteTable -> Text
$sel:catalogId:DeleteTable' :: DeleteTable -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CatalogId" 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
catalogId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DatabaseName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
databaseName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
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 -> 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' :: Int -> DeleteTableResponse
DeleteTableResponse' {$sel:httpStatus:DeleteTableResponse' :: Int
httpStatus = Int
pHttpStatus_}
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