{-# 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.Comprehend.DeleteDocumentClassifier
-- 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 previously created document classifier
--
-- Only those classifiers that are in terminated states (IN_ERROR, TRAINED)
-- will be deleted. If an active inference job is using the model, a
-- @ResourceInUseException@ will be returned.
--
-- This is an asynchronous action that puts the classifier into a DELETING
-- state, and it is then removed by a background job. Once removed, the
-- classifier disappears from your account and is no longer available for
-- use.
module Amazonka.Comprehend.DeleteDocumentClassifier
  ( -- * Creating a Request
    DeleteDocumentClassifier (..),
    newDeleteDocumentClassifier,

    -- * Request Lenses
    deleteDocumentClassifier_documentClassifierArn,

    -- * Destructuring the Response
    DeleteDocumentClassifierResponse (..),
    newDeleteDocumentClassifierResponse,

    -- * Response Lenses
    deleteDocumentClassifierResponse_httpStatus,
  )
where

import Amazonka.Comprehend.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:/ 'newDeleteDocumentClassifier' smart constructor.
data DeleteDocumentClassifier = DeleteDocumentClassifier'
  { -- | The Amazon Resource Name (ARN) that identifies the document classifier.
    DeleteDocumentClassifier -> Text
documentClassifierArn :: Prelude.Text
  }
  deriving (DeleteDocumentClassifier -> DeleteDocumentClassifier -> Bool
(DeleteDocumentClassifier -> DeleteDocumentClassifier -> Bool)
-> (DeleteDocumentClassifier -> DeleteDocumentClassifier -> Bool)
-> Eq DeleteDocumentClassifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDocumentClassifier -> DeleteDocumentClassifier -> Bool
$c/= :: DeleteDocumentClassifier -> DeleteDocumentClassifier -> Bool
== :: DeleteDocumentClassifier -> DeleteDocumentClassifier -> Bool
$c== :: DeleteDocumentClassifier -> DeleteDocumentClassifier -> Bool
Prelude.Eq, ReadPrec [DeleteDocumentClassifier]
ReadPrec DeleteDocumentClassifier
Int -> ReadS DeleteDocumentClassifier
ReadS [DeleteDocumentClassifier]
(Int -> ReadS DeleteDocumentClassifier)
-> ReadS [DeleteDocumentClassifier]
-> ReadPrec DeleteDocumentClassifier
-> ReadPrec [DeleteDocumentClassifier]
-> Read DeleteDocumentClassifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDocumentClassifier]
$creadListPrec :: ReadPrec [DeleteDocumentClassifier]
readPrec :: ReadPrec DeleteDocumentClassifier
$creadPrec :: ReadPrec DeleteDocumentClassifier
readList :: ReadS [DeleteDocumentClassifier]
$creadList :: ReadS [DeleteDocumentClassifier]
readsPrec :: Int -> ReadS DeleteDocumentClassifier
$creadsPrec :: Int -> ReadS DeleteDocumentClassifier
Prelude.Read, Int -> DeleteDocumentClassifier -> ShowS
[DeleteDocumentClassifier] -> ShowS
DeleteDocumentClassifier -> String
(Int -> DeleteDocumentClassifier -> ShowS)
-> (DeleteDocumentClassifier -> String)
-> ([DeleteDocumentClassifier] -> ShowS)
-> Show DeleteDocumentClassifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDocumentClassifier] -> ShowS
$cshowList :: [DeleteDocumentClassifier] -> ShowS
show :: DeleteDocumentClassifier -> String
$cshow :: DeleteDocumentClassifier -> String
showsPrec :: Int -> DeleteDocumentClassifier -> ShowS
$cshowsPrec :: Int -> DeleteDocumentClassifier -> ShowS
Prelude.Show, (forall x.
 DeleteDocumentClassifier -> Rep DeleteDocumentClassifier x)
-> (forall x.
    Rep DeleteDocumentClassifier x -> DeleteDocumentClassifier)
-> Generic DeleteDocumentClassifier
forall x.
Rep DeleteDocumentClassifier x -> DeleteDocumentClassifier
forall x.
DeleteDocumentClassifier -> Rep DeleteDocumentClassifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDocumentClassifier x -> DeleteDocumentClassifier
$cfrom :: forall x.
DeleteDocumentClassifier -> Rep DeleteDocumentClassifier x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDocumentClassifier' 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:
--
-- 'documentClassifierArn', 'deleteDocumentClassifier_documentClassifierArn' - The Amazon Resource Name (ARN) that identifies the document classifier.
newDeleteDocumentClassifier ::
  -- | 'documentClassifierArn'
  Prelude.Text ->
  DeleteDocumentClassifier
newDeleteDocumentClassifier :: Text -> DeleteDocumentClassifier
newDeleteDocumentClassifier Text
pDocumentClassifierArn_ =
  DeleteDocumentClassifier' :: Text -> DeleteDocumentClassifier
DeleteDocumentClassifier'
    { $sel:documentClassifierArn:DeleteDocumentClassifier' :: Text
documentClassifierArn =
        Text
pDocumentClassifierArn_
    }

-- | The Amazon Resource Name (ARN) that identifies the document classifier.
deleteDocumentClassifier_documentClassifierArn :: Lens.Lens' DeleteDocumentClassifier Prelude.Text
deleteDocumentClassifier_documentClassifierArn :: (Text -> f Text)
-> DeleteDocumentClassifier -> f DeleteDocumentClassifier
deleteDocumentClassifier_documentClassifierArn = (DeleteDocumentClassifier -> Text)
-> (DeleteDocumentClassifier -> Text -> DeleteDocumentClassifier)
-> Lens DeleteDocumentClassifier DeleteDocumentClassifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDocumentClassifier' {Text
documentClassifierArn :: Text
$sel:documentClassifierArn:DeleteDocumentClassifier' :: DeleteDocumentClassifier -> Text
documentClassifierArn} -> Text
documentClassifierArn) (\s :: DeleteDocumentClassifier
s@DeleteDocumentClassifier' {} Text
a -> DeleteDocumentClassifier
s {$sel:documentClassifierArn:DeleteDocumentClassifier' :: Text
documentClassifierArn = Text
a} :: DeleteDocumentClassifier)

instance Core.AWSRequest DeleteDocumentClassifier where
  type
    AWSResponse DeleteDocumentClassifier =
      DeleteDocumentClassifierResponse
  request :: DeleteDocumentClassifier -> Request DeleteDocumentClassifier
request = Service
-> DeleteDocumentClassifier -> Request DeleteDocumentClassifier
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDocumentClassifier
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDocumentClassifier)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteDocumentClassifier))
-> Logger
-> Service
-> Proxy DeleteDocumentClassifier
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDocumentClassifier)))
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 -> DeleteDocumentClassifierResponse
DeleteDocumentClassifierResponse'
            (Int -> DeleteDocumentClassifierResponse)
-> Either String Int
-> Either String DeleteDocumentClassifierResponse
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 DeleteDocumentClassifier

instance Prelude.NFData DeleteDocumentClassifier

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

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

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

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

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

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

instance
  Prelude.NFData
    DeleteDocumentClassifierResponse