{-# 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.Glue.DeleteClassifier
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes a classifier from the Data Catalog.
module Amazonka.Glue.DeleteClassifier
  ( -- * Creating a Request
    DeleteClassifier (..),
    newDeleteClassifier,

    -- * Request Lenses
    deleteClassifier_name,

    -- * Destructuring the Response
    DeleteClassifierResponse (..),
    newDeleteClassifierResponse,

    -- * Response Lenses
    deleteClassifierResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'DeleteClassifier' 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', 'deleteClassifier_name' - Name of the classifier to remove.
newDeleteClassifier ::
  -- | 'name'
  Prelude.Text ->
  DeleteClassifier
newDeleteClassifier :: Text -> DeleteClassifier
newDeleteClassifier Text
pName_ =
  DeleteClassifier' {$sel:name:DeleteClassifier' :: Text
name = Text
pName_}

-- | Name of the classifier to remove.
deleteClassifier_name :: Lens.Lens' DeleteClassifier Prelude.Text
deleteClassifier_name :: Lens' DeleteClassifier Text
deleteClassifier_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteClassifier' {Text
name :: Text
$sel:name:DeleteClassifier' :: DeleteClassifier -> Text
name} -> Text
name) (\s :: DeleteClassifier
s@DeleteClassifier' {} Text
a -> DeleteClassifier
s {$sel:name:DeleteClassifier' :: Text
name = Text
a} :: DeleteClassifier)

instance Core.AWSRequest DeleteClassifier where
  type
    AWSResponse DeleteClassifier =
      DeleteClassifierResponse
  request :: (Service -> Service)
-> DeleteClassifier -> Request DeleteClassifier
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 DeleteClassifier
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteClassifier)))
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 -> DeleteClassifierResponse
DeleteClassifierResponse'
            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 DeleteClassifier where
  hashWithSalt :: Int -> DeleteClassifier -> Int
hashWithSalt Int
_salt DeleteClassifier' {Text
name :: Text
$sel:name:DeleteClassifier' :: DeleteClassifier -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

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

instance Data.ToHeaders DeleteClassifier where
  toHeaders :: DeleteClassifier -> 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
"AWSGlue.DeleteClassifier" :: 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 DeleteClassifier where
  toJSON :: DeleteClassifier -> Value
toJSON DeleteClassifier' {Text
name :: Text
$sel:name:DeleteClassifier' :: DeleteClassifier -> 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 DeleteClassifier where
  toPath :: DeleteClassifier -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

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