{-# 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.DescribeDocumentClassifier
-- 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)
--
-- Gets the properties associated with a document classifier.
module Amazonka.Comprehend.DescribeDocumentClassifier
  ( -- * Creating a Request
    DescribeDocumentClassifier (..),
    newDescribeDocumentClassifier,

    -- * Request Lenses
    describeDocumentClassifier_documentClassifierArn,

    -- * Destructuring the Response
    DescribeDocumentClassifierResponse (..),
    newDescribeDocumentClassifierResponse,

    -- * Response Lenses
    describeDocumentClassifierResponse_documentClassifierProperties,
    describeDocumentClassifierResponse_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:/ 'newDescribeDocumentClassifier' smart constructor.
data DescribeDocumentClassifier = DescribeDocumentClassifier'
  { -- | The Amazon Resource Name (ARN) that identifies the document classifier.
    -- The operation returns this identifier in its response.
    DescribeDocumentClassifier -> Text
documentClassifierArn :: Prelude.Text
  }
  deriving (DescribeDocumentClassifier -> DescribeDocumentClassifier -> Bool
(DescribeDocumentClassifier -> DescribeDocumentClassifier -> Bool)
-> (DescribeDocumentClassifier
    -> DescribeDocumentClassifier -> Bool)
-> Eq DescribeDocumentClassifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDocumentClassifier -> DescribeDocumentClassifier -> Bool
$c/= :: DescribeDocumentClassifier -> DescribeDocumentClassifier -> Bool
== :: DescribeDocumentClassifier -> DescribeDocumentClassifier -> Bool
$c== :: DescribeDocumentClassifier -> DescribeDocumentClassifier -> Bool
Prelude.Eq, ReadPrec [DescribeDocumentClassifier]
ReadPrec DescribeDocumentClassifier
Int -> ReadS DescribeDocumentClassifier
ReadS [DescribeDocumentClassifier]
(Int -> ReadS DescribeDocumentClassifier)
-> ReadS [DescribeDocumentClassifier]
-> ReadPrec DescribeDocumentClassifier
-> ReadPrec [DescribeDocumentClassifier]
-> Read DescribeDocumentClassifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDocumentClassifier]
$creadListPrec :: ReadPrec [DescribeDocumentClassifier]
readPrec :: ReadPrec DescribeDocumentClassifier
$creadPrec :: ReadPrec DescribeDocumentClassifier
readList :: ReadS [DescribeDocumentClassifier]
$creadList :: ReadS [DescribeDocumentClassifier]
readsPrec :: Int -> ReadS DescribeDocumentClassifier
$creadsPrec :: Int -> ReadS DescribeDocumentClassifier
Prelude.Read, Int -> DescribeDocumentClassifier -> ShowS
[DescribeDocumentClassifier] -> ShowS
DescribeDocumentClassifier -> String
(Int -> DescribeDocumentClassifier -> ShowS)
-> (DescribeDocumentClassifier -> String)
-> ([DescribeDocumentClassifier] -> ShowS)
-> Show DescribeDocumentClassifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDocumentClassifier] -> ShowS
$cshowList :: [DescribeDocumentClassifier] -> ShowS
show :: DescribeDocumentClassifier -> String
$cshow :: DescribeDocumentClassifier -> String
showsPrec :: Int -> DescribeDocumentClassifier -> ShowS
$cshowsPrec :: Int -> DescribeDocumentClassifier -> ShowS
Prelude.Show, (forall x.
 DescribeDocumentClassifier -> Rep DescribeDocumentClassifier x)
-> (forall x.
    Rep DescribeDocumentClassifier x -> DescribeDocumentClassifier)
-> Generic DescribeDocumentClassifier
forall x.
Rep DescribeDocumentClassifier x -> DescribeDocumentClassifier
forall x.
DescribeDocumentClassifier -> Rep DescribeDocumentClassifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDocumentClassifier x -> DescribeDocumentClassifier
$cfrom :: forall x.
DescribeDocumentClassifier -> Rep DescribeDocumentClassifier x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDocumentClassifier' 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', 'describeDocumentClassifier_documentClassifierArn' - The Amazon Resource Name (ARN) that identifies the document classifier.
-- The operation returns this identifier in its response.
newDescribeDocumentClassifier ::
  -- | 'documentClassifierArn'
  Prelude.Text ->
  DescribeDocumentClassifier
newDescribeDocumentClassifier :: Text -> DescribeDocumentClassifier
newDescribeDocumentClassifier Text
pDocumentClassifierArn_ =
  DescribeDocumentClassifier' :: Text -> DescribeDocumentClassifier
DescribeDocumentClassifier'
    { $sel:documentClassifierArn:DescribeDocumentClassifier' :: Text
documentClassifierArn =
        Text
pDocumentClassifierArn_
    }

-- | The Amazon Resource Name (ARN) that identifies the document classifier.
-- The operation returns this identifier in its response.
describeDocumentClassifier_documentClassifierArn :: Lens.Lens' DescribeDocumentClassifier Prelude.Text
describeDocumentClassifier_documentClassifierArn :: (Text -> f Text)
-> DescribeDocumentClassifier -> f DescribeDocumentClassifier
describeDocumentClassifier_documentClassifierArn = (DescribeDocumentClassifier -> Text)
-> (DescribeDocumentClassifier
    -> Text -> DescribeDocumentClassifier)
-> Lens
     DescribeDocumentClassifier DescribeDocumentClassifier Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentClassifier' {Text
documentClassifierArn :: Text
$sel:documentClassifierArn:DescribeDocumentClassifier' :: DescribeDocumentClassifier -> Text
documentClassifierArn} -> Text
documentClassifierArn) (\s :: DescribeDocumentClassifier
s@DescribeDocumentClassifier' {} Text
a -> DescribeDocumentClassifier
s {$sel:documentClassifierArn:DescribeDocumentClassifier' :: Text
documentClassifierArn = Text
a} :: DescribeDocumentClassifier)

instance Core.AWSRequest DescribeDocumentClassifier where
  type
    AWSResponse DescribeDocumentClassifier =
      DescribeDocumentClassifierResponse
  request :: DescribeDocumentClassifier -> Request DescribeDocumentClassifier
request = Service
-> DescribeDocumentClassifier -> Request DescribeDocumentClassifier
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDocumentClassifier
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDocumentClassifier)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeDocumentClassifier))
-> Logger
-> Service
-> Proxy DescribeDocumentClassifier
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDocumentClassifier)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe DocumentClassifierProperties
-> Int -> DescribeDocumentClassifierResponse
DescribeDocumentClassifierResponse'
            (Maybe DocumentClassifierProperties
 -> Int -> DescribeDocumentClassifierResponse)
-> Either String (Maybe DocumentClassifierProperties)
-> Either String (Int -> DescribeDocumentClassifierResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe DocumentClassifierProperties)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DocumentClassifierProperties")
            Either String (Int -> DescribeDocumentClassifierResponse)
-> Either String Int
-> Either String DescribeDocumentClassifierResponse
forall (f :: * -> *) a b. Applicative f => 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 DescribeDocumentClassifier

instance Prelude.NFData DescribeDocumentClassifier

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

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

-- | /See:/ 'newDescribeDocumentClassifierResponse' smart constructor.
data DescribeDocumentClassifierResponse = DescribeDocumentClassifierResponse'
  { -- | An object that contains the properties associated with a document
    -- classifier.
    DescribeDocumentClassifierResponse
-> Maybe DocumentClassifierProperties
documentClassifierProperties :: Prelude.Maybe DocumentClassifierProperties,
    -- | The response's http status code.
    DescribeDocumentClassifierResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDocumentClassifierResponse
-> DescribeDocumentClassifierResponse -> Bool
(DescribeDocumentClassifierResponse
 -> DescribeDocumentClassifierResponse -> Bool)
-> (DescribeDocumentClassifierResponse
    -> DescribeDocumentClassifierResponse -> Bool)
-> Eq DescribeDocumentClassifierResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDocumentClassifierResponse
-> DescribeDocumentClassifierResponse -> Bool
$c/= :: DescribeDocumentClassifierResponse
-> DescribeDocumentClassifierResponse -> Bool
== :: DescribeDocumentClassifierResponse
-> DescribeDocumentClassifierResponse -> Bool
$c== :: DescribeDocumentClassifierResponse
-> DescribeDocumentClassifierResponse -> Bool
Prelude.Eq, Int -> DescribeDocumentClassifierResponse -> ShowS
[DescribeDocumentClassifierResponse] -> ShowS
DescribeDocumentClassifierResponse -> String
(Int -> DescribeDocumentClassifierResponse -> ShowS)
-> (DescribeDocumentClassifierResponse -> String)
-> ([DescribeDocumentClassifierResponse] -> ShowS)
-> Show DescribeDocumentClassifierResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDocumentClassifierResponse] -> ShowS
$cshowList :: [DescribeDocumentClassifierResponse] -> ShowS
show :: DescribeDocumentClassifierResponse -> String
$cshow :: DescribeDocumentClassifierResponse -> String
showsPrec :: Int -> DescribeDocumentClassifierResponse -> ShowS
$cshowsPrec :: Int -> DescribeDocumentClassifierResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDocumentClassifierResponse
 -> Rep DescribeDocumentClassifierResponse x)
-> (forall x.
    Rep DescribeDocumentClassifierResponse x
    -> DescribeDocumentClassifierResponse)
-> Generic DescribeDocumentClassifierResponse
forall x.
Rep DescribeDocumentClassifierResponse x
-> DescribeDocumentClassifierResponse
forall x.
DescribeDocumentClassifierResponse
-> Rep DescribeDocumentClassifierResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDocumentClassifierResponse x
-> DescribeDocumentClassifierResponse
$cfrom :: forall x.
DescribeDocumentClassifierResponse
-> Rep DescribeDocumentClassifierResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDocumentClassifierResponse' 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:
--
-- 'documentClassifierProperties', 'describeDocumentClassifierResponse_documentClassifierProperties' - An object that contains the properties associated with a document
-- classifier.
--
-- 'httpStatus', 'describeDocumentClassifierResponse_httpStatus' - The response's http status code.
newDescribeDocumentClassifierResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDocumentClassifierResponse
newDescribeDocumentClassifierResponse :: Int -> DescribeDocumentClassifierResponse
newDescribeDocumentClassifierResponse Int
pHttpStatus_ =
  DescribeDocumentClassifierResponse' :: Maybe DocumentClassifierProperties
-> Int -> DescribeDocumentClassifierResponse
DescribeDocumentClassifierResponse'
    { $sel:documentClassifierProperties:DescribeDocumentClassifierResponse' :: Maybe DocumentClassifierProperties
documentClassifierProperties =
        Maybe DocumentClassifierProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDocumentClassifierResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that contains the properties associated with a document
-- classifier.
describeDocumentClassifierResponse_documentClassifierProperties :: Lens.Lens' DescribeDocumentClassifierResponse (Prelude.Maybe DocumentClassifierProperties)
describeDocumentClassifierResponse_documentClassifierProperties :: (Maybe DocumentClassifierProperties
 -> f (Maybe DocumentClassifierProperties))
-> DescribeDocumentClassifierResponse
-> f DescribeDocumentClassifierResponse
describeDocumentClassifierResponse_documentClassifierProperties = (DescribeDocumentClassifierResponse
 -> Maybe DocumentClassifierProperties)
-> (DescribeDocumentClassifierResponse
    -> Maybe DocumentClassifierProperties
    -> DescribeDocumentClassifierResponse)
-> Lens
     DescribeDocumentClassifierResponse
     DescribeDocumentClassifierResponse
     (Maybe DocumentClassifierProperties)
     (Maybe DocumentClassifierProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentClassifierResponse' {Maybe DocumentClassifierProperties
documentClassifierProperties :: Maybe DocumentClassifierProperties
$sel:documentClassifierProperties:DescribeDocumentClassifierResponse' :: DescribeDocumentClassifierResponse
-> Maybe DocumentClassifierProperties
documentClassifierProperties} -> Maybe DocumentClassifierProperties
documentClassifierProperties) (\s :: DescribeDocumentClassifierResponse
s@DescribeDocumentClassifierResponse' {} Maybe DocumentClassifierProperties
a -> DescribeDocumentClassifierResponse
s {$sel:documentClassifierProperties:DescribeDocumentClassifierResponse' :: Maybe DocumentClassifierProperties
documentClassifierProperties = Maybe DocumentClassifierProperties
a} :: DescribeDocumentClassifierResponse)

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

instance
  Prelude.NFData
    DescribeDocumentClassifierResponse