{-# 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.DeleteDatabase
(
DeleteDatabase (..),
newDeleteDatabase,
deleteDatabase_catalogId,
deleteDatabase_name,
DeleteDatabaseResponse (..),
newDeleteDatabaseResponse,
deleteDatabaseResponse_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 DeleteDatabase = DeleteDatabase'
{
DeleteDatabase -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
DeleteDatabase -> Text
name :: Prelude.Text
}
deriving (DeleteDatabase -> DeleteDatabase -> Bool
(DeleteDatabase -> DeleteDatabase -> Bool)
-> (DeleteDatabase -> DeleteDatabase -> Bool) -> Eq DeleteDatabase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDatabase -> DeleteDatabase -> Bool
$c/= :: DeleteDatabase -> DeleteDatabase -> Bool
== :: DeleteDatabase -> DeleteDatabase -> Bool
$c== :: DeleteDatabase -> DeleteDatabase -> Bool
Prelude.Eq, ReadPrec [DeleteDatabase]
ReadPrec DeleteDatabase
Int -> ReadS DeleteDatabase
ReadS [DeleteDatabase]
(Int -> ReadS DeleteDatabase)
-> ReadS [DeleteDatabase]
-> ReadPrec DeleteDatabase
-> ReadPrec [DeleteDatabase]
-> Read DeleteDatabase
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDatabase]
$creadListPrec :: ReadPrec [DeleteDatabase]
readPrec :: ReadPrec DeleteDatabase
$creadPrec :: ReadPrec DeleteDatabase
readList :: ReadS [DeleteDatabase]
$creadList :: ReadS [DeleteDatabase]
readsPrec :: Int -> ReadS DeleteDatabase
$creadsPrec :: Int -> ReadS DeleteDatabase
Prelude.Read, Int -> DeleteDatabase -> ShowS
[DeleteDatabase] -> ShowS
DeleteDatabase -> String
(Int -> DeleteDatabase -> ShowS)
-> (DeleteDatabase -> String)
-> ([DeleteDatabase] -> ShowS)
-> Show DeleteDatabase
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDatabase] -> ShowS
$cshowList :: [DeleteDatabase] -> ShowS
show :: DeleteDatabase -> String
$cshow :: DeleteDatabase -> String
showsPrec :: Int -> DeleteDatabase -> ShowS
$cshowsPrec :: Int -> DeleteDatabase -> ShowS
Prelude.Show, (forall x. DeleteDatabase -> Rep DeleteDatabase x)
-> (forall x. Rep DeleteDatabase x -> DeleteDatabase)
-> Generic DeleteDatabase
forall x. Rep DeleteDatabase x -> DeleteDatabase
forall x. DeleteDatabase -> Rep DeleteDatabase x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDatabase x -> DeleteDatabase
$cfrom :: forall x. DeleteDatabase -> Rep DeleteDatabase x
Prelude.Generic)
newDeleteDatabase ::
Prelude.Text ->
DeleteDatabase
newDeleteDatabase :: Text -> DeleteDatabase
newDeleteDatabase Text
pName_ =
DeleteDatabase' :: Maybe Text -> Text -> DeleteDatabase
DeleteDatabase'
{ $sel:catalogId:DeleteDatabase' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:DeleteDatabase' :: Text
name = Text
pName_
}
deleteDatabase_catalogId :: Lens.Lens' DeleteDatabase (Prelude.Maybe Prelude.Text)
deleteDatabase_catalogId :: (Maybe Text -> f (Maybe Text))
-> DeleteDatabase -> f DeleteDatabase
deleteDatabase_catalogId = (DeleteDatabase -> Maybe Text)
-> (DeleteDatabase -> Maybe Text -> DeleteDatabase)
-> Lens DeleteDatabase DeleteDatabase (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDatabase' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:DeleteDatabase' :: DeleteDatabase -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: DeleteDatabase
s@DeleteDatabase' {} Maybe Text
a -> DeleteDatabase
s {$sel:catalogId:DeleteDatabase' :: Maybe Text
catalogId = Maybe Text
a} :: DeleteDatabase)
deleteDatabase_name :: Lens.Lens' DeleteDatabase Prelude.Text
deleteDatabase_name :: (Text -> f Text) -> DeleteDatabase -> f DeleteDatabase
deleteDatabase_name = (DeleteDatabase -> Text)
-> (DeleteDatabase -> Text -> DeleteDatabase)
-> Lens DeleteDatabase DeleteDatabase Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDatabase' {Text
name :: Text
$sel:name:DeleteDatabase' :: DeleteDatabase -> Text
name} -> Text
name) (\s :: DeleteDatabase
s@DeleteDatabase' {} Text
a -> DeleteDatabase
s {$sel:name:DeleteDatabase' :: Text
name = Text
a} :: DeleteDatabase)
instance Core.AWSRequest DeleteDatabase where
type
AWSResponse DeleteDatabase =
DeleteDatabaseResponse
request :: DeleteDatabase -> Request DeleteDatabase
request = Service -> DeleteDatabase -> Request DeleteDatabase
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteDatabase
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDatabase)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DeleteDatabase))
-> Logger
-> Service
-> Proxy DeleteDatabase
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDatabase)))
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 -> DeleteDatabaseResponse
DeleteDatabaseResponse'
(Int -> DeleteDatabaseResponse)
-> Either String Int -> Either String DeleteDatabaseResponse
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 DeleteDatabase
instance Prelude.NFData DeleteDatabase
instance Core.ToHeaders DeleteDatabase where
toHeaders :: DeleteDatabase -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteDatabase -> 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.DeleteDatabase" :: 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 DeleteDatabase where
toJSON :: DeleteDatabase -> Value
toJSON DeleteDatabase' {Maybe Text
Text
name :: Text
catalogId :: Maybe Text
$sel:name:DeleteDatabase' :: DeleteDatabase -> Text
$sel:catalogId:DeleteDatabase' :: DeleteDatabase -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath DeleteDatabase where
toPath :: DeleteDatabase -> ByteString
toPath = ByteString -> DeleteDatabase -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteDatabase where
toQuery :: DeleteDatabase -> QueryString
toQuery = QueryString -> DeleteDatabase -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteDatabaseResponse = DeleteDatabaseResponse'
{
DeleteDatabaseResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteDatabaseResponse -> DeleteDatabaseResponse -> Bool
(DeleteDatabaseResponse -> DeleteDatabaseResponse -> Bool)
-> (DeleteDatabaseResponse -> DeleteDatabaseResponse -> Bool)
-> Eq DeleteDatabaseResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDatabaseResponse -> DeleteDatabaseResponse -> Bool
$c/= :: DeleteDatabaseResponse -> DeleteDatabaseResponse -> Bool
== :: DeleteDatabaseResponse -> DeleteDatabaseResponse -> Bool
$c== :: DeleteDatabaseResponse -> DeleteDatabaseResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDatabaseResponse]
ReadPrec DeleteDatabaseResponse
Int -> ReadS DeleteDatabaseResponse
ReadS [DeleteDatabaseResponse]
(Int -> ReadS DeleteDatabaseResponse)
-> ReadS [DeleteDatabaseResponse]
-> ReadPrec DeleteDatabaseResponse
-> ReadPrec [DeleteDatabaseResponse]
-> Read DeleteDatabaseResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDatabaseResponse]
$creadListPrec :: ReadPrec [DeleteDatabaseResponse]
readPrec :: ReadPrec DeleteDatabaseResponse
$creadPrec :: ReadPrec DeleteDatabaseResponse
readList :: ReadS [DeleteDatabaseResponse]
$creadList :: ReadS [DeleteDatabaseResponse]
readsPrec :: Int -> ReadS DeleteDatabaseResponse
$creadsPrec :: Int -> ReadS DeleteDatabaseResponse
Prelude.Read, Int -> DeleteDatabaseResponse -> ShowS
[DeleteDatabaseResponse] -> ShowS
DeleteDatabaseResponse -> String
(Int -> DeleteDatabaseResponse -> ShowS)
-> (DeleteDatabaseResponse -> String)
-> ([DeleteDatabaseResponse] -> ShowS)
-> Show DeleteDatabaseResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDatabaseResponse] -> ShowS
$cshowList :: [DeleteDatabaseResponse] -> ShowS
show :: DeleteDatabaseResponse -> String
$cshow :: DeleteDatabaseResponse -> String
showsPrec :: Int -> DeleteDatabaseResponse -> ShowS
$cshowsPrec :: Int -> DeleteDatabaseResponse -> ShowS
Prelude.Show, (forall x. DeleteDatabaseResponse -> Rep DeleteDatabaseResponse x)
-> (forall x.
Rep DeleteDatabaseResponse x -> DeleteDatabaseResponse)
-> Generic DeleteDatabaseResponse
forall x. Rep DeleteDatabaseResponse x -> DeleteDatabaseResponse
forall x. DeleteDatabaseResponse -> Rep DeleteDatabaseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDatabaseResponse x -> DeleteDatabaseResponse
$cfrom :: forall x. DeleteDatabaseResponse -> Rep DeleteDatabaseResponse x
Prelude.Generic)
newDeleteDatabaseResponse ::
Prelude.Int ->
DeleteDatabaseResponse
newDeleteDatabaseResponse :: Int -> DeleteDatabaseResponse
newDeleteDatabaseResponse Int
pHttpStatus_ =
DeleteDatabaseResponse' :: Int -> DeleteDatabaseResponse
DeleteDatabaseResponse' {$sel:httpStatus:DeleteDatabaseResponse' :: Int
httpStatus = Int
pHttpStatus_}
deleteDatabaseResponse_httpStatus :: Lens.Lens' DeleteDatabaseResponse Prelude.Int
deleteDatabaseResponse_httpStatus :: (Int -> f Int)
-> DeleteDatabaseResponse -> f DeleteDatabaseResponse
deleteDatabaseResponse_httpStatus = (DeleteDatabaseResponse -> Int)
-> (DeleteDatabaseResponse -> Int -> DeleteDatabaseResponse)
-> Lens DeleteDatabaseResponse DeleteDatabaseResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDatabaseResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDatabaseResponse' :: DeleteDatabaseResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteDatabaseResponse
s@DeleteDatabaseResponse' {} Int
a -> DeleteDatabaseResponse
s {$sel:httpStatus:DeleteDatabaseResponse' :: Int
httpStatus = Int
a} :: DeleteDatabaseResponse)
instance Prelude.NFData DeleteDatabaseResponse