{-# 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.Athena.DeleteDataCatalog
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a data catalog.
module Amazonka.Athena.DeleteDataCatalog
  ( -- * Creating a Request
    DeleteDataCatalog (..),
    newDeleteDataCatalog,

    -- * Request Lenses
    deleteDataCatalog_name,

    -- * Destructuring the Response
    DeleteDataCatalogResponse (..),
    newDeleteDataCatalogResponse,

    -- * Response Lenses
    deleteDataCatalogResponse_httpStatus,
  )
where

import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteDataCatalog' smart constructor.
data DeleteDataCatalog = DeleteDataCatalog'
  { -- | The name of the data catalog to delete.
    DeleteDataCatalog -> Text
name :: Prelude.Text
  }
  deriving (DeleteDataCatalog -> DeleteDataCatalog -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDataCatalog -> DeleteDataCatalog -> Bool
$c/= :: DeleteDataCatalog -> DeleteDataCatalog -> Bool
== :: DeleteDataCatalog -> DeleteDataCatalog -> Bool
$c== :: DeleteDataCatalog -> DeleteDataCatalog -> Bool
Prelude.Eq, ReadPrec [DeleteDataCatalog]
ReadPrec DeleteDataCatalog
Int -> ReadS DeleteDataCatalog
ReadS [DeleteDataCatalog]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDataCatalog]
$creadListPrec :: ReadPrec [DeleteDataCatalog]
readPrec :: ReadPrec DeleteDataCatalog
$creadPrec :: ReadPrec DeleteDataCatalog
readList :: ReadS [DeleteDataCatalog]
$creadList :: ReadS [DeleteDataCatalog]
readsPrec :: Int -> ReadS DeleteDataCatalog
$creadsPrec :: Int -> ReadS DeleteDataCatalog
Prelude.Read, Int -> DeleteDataCatalog -> ShowS
[DeleteDataCatalog] -> ShowS
DeleteDataCatalog -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDataCatalog] -> ShowS
$cshowList :: [DeleteDataCatalog] -> ShowS
show :: DeleteDataCatalog -> String
$cshow :: DeleteDataCatalog -> String
showsPrec :: Int -> DeleteDataCatalog -> ShowS
$cshowsPrec :: Int -> DeleteDataCatalog -> ShowS
Prelude.Show, forall x. Rep DeleteDataCatalog x -> DeleteDataCatalog
forall x. DeleteDataCatalog -> Rep DeleteDataCatalog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDataCatalog x -> DeleteDataCatalog
$cfrom :: forall x. DeleteDataCatalog -> Rep DeleteDataCatalog x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDataCatalog' 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:
--
-- 'name', 'deleteDataCatalog_name' - The name of the data catalog to delete.
newDeleteDataCatalog ::
  -- | 'name'
  Prelude.Text ->
  DeleteDataCatalog
newDeleteDataCatalog :: Text -> DeleteDataCatalog
newDeleteDataCatalog Text
pName_ =
  DeleteDataCatalog' {$sel:name:DeleteDataCatalog' :: Text
name = Text
pName_}

-- | The name of the data catalog to delete.
deleteDataCatalog_name :: Lens.Lens' DeleteDataCatalog Prelude.Text
deleteDataCatalog_name :: Lens' DeleteDataCatalog Text
deleteDataCatalog_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDataCatalog' {Text
name :: Text
$sel:name:DeleteDataCatalog' :: DeleteDataCatalog -> Text
name} -> Text
name) (\s :: DeleteDataCatalog
s@DeleteDataCatalog' {} Text
a -> DeleteDataCatalog
s {$sel:name:DeleteDataCatalog' :: Text
name = Text
a} :: DeleteDataCatalog)

instance Core.AWSRequest DeleteDataCatalog where
  type
    AWSResponse DeleteDataCatalog =
      DeleteDataCatalogResponse
  request :: (Service -> Service)
-> DeleteDataCatalog -> Request DeleteDataCatalog
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteDataCatalog
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDataCatalog)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteDataCatalogResponse
DeleteDataCatalogResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteDataCatalog where
  hashWithSalt :: Int -> DeleteDataCatalog -> Int
hashWithSalt Int
_salt DeleteDataCatalog' {Text
name :: Text
$sel:name:DeleteDataCatalog' :: DeleteDataCatalog -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData DeleteDataCatalog where
  rnf :: DeleteDataCatalog -> ()
rnf DeleteDataCatalog' {Text
name :: Text
$sel:name:DeleteDataCatalog' :: DeleteDataCatalog -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name

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

instance Data.ToJSON DeleteDataCatalog where
  toJSON :: DeleteDataCatalog -> Value
toJSON DeleteDataCatalog' {Text
name :: Text
$sel:name:DeleteDataCatalog' :: DeleteDataCatalog -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
      )

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

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

-- | /See:/ 'newDeleteDataCatalogResponse' smart constructor.
data DeleteDataCatalogResponse = DeleteDataCatalogResponse'
  { -- | The response's http status code.
    DeleteDataCatalogResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteDataCatalogResponse -> DeleteDataCatalogResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDataCatalogResponse -> DeleteDataCatalogResponse -> Bool
$c/= :: DeleteDataCatalogResponse -> DeleteDataCatalogResponse -> Bool
== :: DeleteDataCatalogResponse -> DeleteDataCatalogResponse -> Bool
$c== :: DeleteDataCatalogResponse -> DeleteDataCatalogResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDataCatalogResponse]
ReadPrec DeleteDataCatalogResponse
Int -> ReadS DeleteDataCatalogResponse
ReadS [DeleteDataCatalogResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDataCatalogResponse]
$creadListPrec :: ReadPrec [DeleteDataCatalogResponse]
readPrec :: ReadPrec DeleteDataCatalogResponse
$creadPrec :: ReadPrec DeleteDataCatalogResponse
readList :: ReadS [DeleteDataCatalogResponse]
$creadList :: ReadS [DeleteDataCatalogResponse]
readsPrec :: Int -> ReadS DeleteDataCatalogResponse
$creadsPrec :: Int -> ReadS DeleteDataCatalogResponse
Prelude.Read, Int -> DeleteDataCatalogResponse -> ShowS
[DeleteDataCatalogResponse] -> ShowS
DeleteDataCatalogResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDataCatalogResponse] -> ShowS
$cshowList :: [DeleteDataCatalogResponse] -> ShowS
show :: DeleteDataCatalogResponse -> String
$cshow :: DeleteDataCatalogResponse -> String
showsPrec :: Int -> DeleteDataCatalogResponse -> ShowS
$cshowsPrec :: Int -> DeleteDataCatalogResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteDataCatalogResponse x -> DeleteDataCatalogResponse
forall x.
DeleteDataCatalogResponse -> Rep DeleteDataCatalogResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDataCatalogResponse x -> DeleteDataCatalogResponse
$cfrom :: forall x.
DeleteDataCatalogResponse -> Rep DeleteDataCatalogResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDataCatalogResponse' 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:
--
-- 'httpStatus', 'deleteDataCatalogResponse_httpStatus' - The response's http status code.
newDeleteDataCatalogResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteDataCatalogResponse
newDeleteDataCatalogResponse :: Int -> DeleteDataCatalogResponse
newDeleteDataCatalogResponse Int
pHttpStatus_ =
  DeleteDataCatalogResponse'
    { $sel:httpStatus:DeleteDataCatalogResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData DeleteDataCatalogResponse where
  rnf :: DeleteDataCatalogResponse -> ()
rnf DeleteDataCatalogResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDataCatalogResponse' :: DeleteDataCatalogResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus