{-# 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-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 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.Lens as Lens
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
(DeleteDataCatalog -> DeleteDataCatalog -> Bool)
-> (DeleteDataCatalog -> DeleteDataCatalog -> Bool)
-> Eq DeleteDataCatalog
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]
(Int -> ReadS DeleteDataCatalog)
-> ReadS [DeleteDataCatalog]
-> ReadPrec DeleteDataCatalog
-> ReadPrec [DeleteDataCatalog]
-> Read 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
(Int -> DeleteDataCatalog -> ShowS)
-> (DeleteDataCatalog -> String)
-> ([DeleteDataCatalog] -> ShowS)
-> Show DeleteDataCatalog
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. DeleteDataCatalog -> Rep DeleteDataCatalog x)
-> (forall x. Rep DeleteDataCatalog x -> DeleteDataCatalog)
-> Generic DeleteDataCatalog
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' :: Text -> DeleteDataCatalog
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 :: (Text -> f Text) -> DeleteDataCatalog -> f DeleteDataCatalog
deleteDataCatalog_name = (DeleteDataCatalog -> Text)
-> (DeleteDataCatalog -> Text -> DeleteDataCatalog)
-> Lens DeleteDataCatalog DeleteDataCatalog Text Text
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 :: DeleteDataCatalog -> Request DeleteDataCatalog
request = Service -> DeleteDataCatalog -> Request DeleteDataCatalog
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDataCatalog
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDataCatalog)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteDataCatalog))
-> Logger
-> Service
-> Proxy DeleteDataCatalog
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDataCatalog)))
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 -> DeleteDataCatalogResponse
DeleteDataCatalogResponse'
            (Int -> DeleteDataCatalogResponse)
-> Either String Int -> Either String DeleteDataCatalogResponse
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 DeleteDataCatalog

instance Prelude.NFData DeleteDataCatalog

instance Core.ToHeaders DeleteDataCatalog where
  toHeaders :: DeleteDataCatalog -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteDataCatalog -> 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
"AmazonAthena.DeleteDataCatalog" ::
                          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 DeleteDataCatalog where
  toJSON :: DeleteDataCatalog -> Value
toJSON DeleteDataCatalog' {Text
name :: Text
$sel:name:DeleteDataCatalog' :: DeleteDataCatalog -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )

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

instance Core.ToQuery DeleteDataCatalog where
  toQuery :: DeleteDataCatalog -> QueryString
toQuery = QueryString -> DeleteDataCatalog -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteDataCatalogResponse -> DeleteDataCatalogResponse -> Bool)
-> (DeleteDataCatalogResponse -> DeleteDataCatalogResponse -> Bool)
-> Eq DeleteDataCatalogResponse
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]
(Int -> ReadS DeleteDataCatalogResponse)
-> ReadS [DeleteDataCatalogResponse]
-> ReadPrec DeleteDataCatalogResponse
-> ReadPrec [DeleteDataCatalogResponse]
-> Read 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
(Int -> DeleteDataCatalogResponse -> ShowS)
-> (DeleteDataCatalogResponse -> String)
-> ([DeleteDataCatalogResponse] -> ShowS)
-> Show DeleteDataCatalogResponse
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.
 DeleteDataCatalogResponse -> Rep DeleteDataCatalogResponse x)
-> (forall x.
    Rep DeleteDataCatalogResponse x -> DeleteDataCatalogResponse)
-> Generic DeleteDataCatalogResponse
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' :: Int -> DeleteDataCatalogResponse
DeleteDataCatalogResponse'
    { $sel:httpStatus:DeleteDataCatalogResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteDataCatalogResponse_httpStatus :: Lens.Lens' DeleteDataCatalogResponse Prelude.Int
deleteDataCatalogResponse_httpStatus :: (Int -> f Int)
-> DeleteDataCatalogResponse -> f DeleteDataCatalogResponse
deleteDataCatalogResponse_httpStatus = (DeleteDataCatalogResponse -> Int)
-> (DeleteDataCatalogResponse -> Int -> DeleteDataCatalogResponse)
-> Lens DeleteDataCatalogResponse DeleteDataCatalogResponse Int Int
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