{-# 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-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)
--
-- 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 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

-- | /See:/ 'newDeleteClassifier' smart constructor.
data DeleteClassifier = DeleteClassifier'
  { -- | Name of the classifier to remove.
    DeleteClassifier -> Text
name :: Prelude.Text
  }
  deriving (DeleteClassifier -> DeleteClassifier -> Bool
(DeleteClassifier -> DeleteClassifier -> Bool)
-> (DeleteClassifier -> DeleteClassifier -> Bool)
-> Eq DeleteClassifier
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]
(Int -> ReadS DeleteClassifier)
-> ReadS [DeleteClassifier]
-> ReadPrec DeleteClassifier
-> ReadPrec [DeleteClassifier]
-> Read 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
(Int -> DeleteClassifier -> ShowS)
-> (DeleteClassifier -> String)
-> ([DeleteClassifier] -> ShowS)
-> Show DeleteClassifier
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. DeleteClassifier -> Rep DeleteClassifier x)
-> (forall x. Rep DeleteClassifier x -> DeleteClassifier)
-> Generic DeleteClassifier
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' :: Text -> DeleteClassifier
DeleteClassifier' {$sel:name:DeleteClassifier' :: Text
name = Text
pName_}

-- | Name of the classifier to remove.
deleteClassifier_name :: Lens.Lens' DeleteClassifier Prelude.Text
deleteClassifier_name :: (Text -> f Text) -> DeleteClassifier -> f DeleteClassifier
deleteClassifier_name = (DeleteClassifier -> Text)
-> (DeleteClassifier -> Text -> DeleteClassifier)
-> Lens DeleteClassifier DeleteClassifier Text Text
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 :: DeleteClassifier -> Request DeleteClassifier
request = Service -> DeleteClassifier -> Request DeleteClassifier
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteClassifier
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteClassifier)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteClassifier))
-> Logger
-> Service
-> Proxy DeleteClassifier
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteClassifier)))
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 -> DeleteClassifierResponse
DeleteClassifierResponse'
            (Int -> DeleteClassifierResponse)
-> Either String Int -> Either String DeleteClassifierResponse
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 DeleteClassifier

instance Prelude.NFData DeleteClassifier

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

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

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