{-# 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.DescribeDocumentClassificationJob
-- 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 classification job. Use
-- this operation to get the status of a classification job.
module Amazonka.Comprehend.DescribeDocumentClassificationJob
  ( -- * Creating a Request
    DescribeDocumentClassificationJob (..),
    newDescribeDocumentClassificationJob,

    -- * Request Lenses
    describeDocumentClassificationJob_jobId,

    -- * Destructuring the Response
    DescribeDocumentClassificationJobResponse (..),
    newDescribeDocumentClassificationJobResponse,

    -- * Response Lenses
    describeDocumentClassificationJobResponse_documentClassificationJobProperties,
    describeDocumentClassificationJobResponse_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:/ 'newDescribeDocumentClassificationJob' smart constructor.
data DescribeDocumentClassificationJob = DescribeDocumentClassificationJob'
  { -- | The identifier that Amazon Comprehend generated for the job. The
    -- operation returns this identifier in its response.
    DescribeDocumentClassificationJob -> Text
jobId :: Prelude.Text
  }
  deriving (DescribeDocumentClassificationJob
-> DescribeDocumentClassificationJob -> Bool
(DescribeDocumentClassificationJob
 -> DescribeDocumentClassificationJob -> Bool)
-> (DescribeDocumentClassificationJob
    -> DescribeDocumentClassificationJob -> Bool)
-> Eq DescribeDocumentClassificationJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDocumentClassificationJob
-> DescribeDocumentClassificationJob -> Bool
$c/= :: DescribeDocumentClassificationJob
-> DescribeDocumentClassificationJob -> Bool
== :: DescribeDocumentClassificationJob
-> DescribeDocumentClassificationJob -> Bool
$c== :: DescribeDocumentClassificationJob
-> DescribeDocumentClassificationJob -> Bool
Prelude.Eq, ReadPrec [DescribeDocumentClassificationJob]
ReadPrec DescribeDocumentClassificationJob
Int -> ReadS DescribeDocumentClassificationJob
ReadS [DescribeDocumentClassificationJob]
(Int -> ReadS DescribeDocumentClassificationJob)
-> ReadS [DescribeDocumentClassificationJob]
-> ReadPrec DescribeDocumentClassificationJob
-> ReadPrec [DescribeDocumentClassificationJob]
-> Read DescribeDocumentClassificationJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDocumentClassificationJob]
$creadListPrec :: ReadPrec [DescribeDocumentClassificationJob]
readPrec :: ReadPrec DescribeDocumentClassificationJob
$creadPrec :: ReadPrec DescribeDocumentClassificationJob
readList :: ReadS [DescribeDocumentClassificationJob]
$creadList :: ReadS [DescribeDocumentClassificationJob]
readsPrec :: Int -> ReadS DescribeDocumentClassificationJob
$creadsPrec :: Int -> ReadS DescribeDocumentClassificationJob
Prelude.Read, Int -> DescribeDocumentClassificationJob -> ShowS
[DescribeDocumentClassificationJob] -> ShowS
DescribeDocumentClassificationJob -> String
(Int -> DescribeDocumentClassificationJob -> ShowS)
-> (DescribeDocumentClassificationJob -> String)
-> ([DescribeDocumentClassificationJob] -> ShowS)
-> Show DescribeDocumentClassificationJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDocumentClassificationJob] -> ShowS
$cshowList :: [DescribeDocumentClassificationJob] -> ShowS
show :: DescribeDocumentClassificationJob -> String
$cshow :: DescribeDocumentClassificationJob -> String
showsPrec :: Int -> DescribeDocumentClassificationJob -> ShowS
$cshowsPrec :: Int -> DescribeDocumentClassificationJob -> ShowS
Prelude.Show, (forall x.
 DescribeDocumentClassificationJob
 -> Rep DescribeDocumentClassificationJob x)
-> (forall x.
    Rep DescribeDocumentClassificationJob x
    -> DescribeDocumentClassificationJob)
-> Generic DescribeDocumentClassificationJob
forall x.
Rep DescribeDocumentClassificationJob x
-> DescribeDocumentClassificationJob
forall x.
DescribeDocumentClassificationJob
-> Rep DescribeDocumentClassificationJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDocumentClassificationJob x
-> DescribeDocumentClassificationJob
$cfrom :: forall x.
DescribeDocumentClassificationJob
-> Rep DescribeDocumentClassificationJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDocumentClassificationJob' 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:
--
-- 'jobId', 'describeDocumentClassificationJob_jobId' - The identifier that Amazon Comprehend generated for the job. The
-- operation returns this identifier in its response.
newDescribeDocumentClassificationJob ::
  -- | 'jobId'
  Prelude.Text ->
  DescribeDocumentClassificationJob
newDescribeDocumentClassificationJob :: Text -> DescribeDocumentClassificationJob
newDescribeDocumentClassificationJob Text
pJobId_ =
  DescribeDocumentClassificationJob' :: Text -> DescribeDocumentClassificationJob
DescribeDocumentClassificationJob' {$sel:jobId:DescribeDocumentClassificationJob' :: Text
jobId = Text
pJobId_}

-- | The identifier that Amazon Comprehend generated for the job. The
-- operation returns this identifier in its response.
describeDocumentClassificationJob_jobId :: Lens.Lens' DescribeDocumentClassificationJob Prelude.Text
describeDocumentClassificationJob_jobId :: (Text -> f Text)
-> DescribeDocumentClassificationJob
-> f DescribeDocumentClassificationJob
describeDocumentClassificationJob_jobId = (DescribeDocumentClassificationJob -> Text)
-> (DescribeDocumentClassificationJob
    -> Text -> DescribeDocumentClassificationJob)
-> Lens
     DescribeDocumentClassificationJob
     DescribeDocumentClassificationJob
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentClassificationJob' {Text
jobId :: Text
$sel:jobId:DescribeDocumentClassificationJob' :: DescribeDocumentClassificationJob -> Text
jobId} -> Text
jobId) (\s :: DescribeDocumentClassificationJob
s@DescribeDocumentClassificationJob' {} Text
a -> DescribeDocumentClassificationJob
s {$sel:jobId:DescribeDocumentClassificationJob' :: Text
jobId = Text
a} :: DescribeDocumentClassificationJob)

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

instance
  Prelude.NFData
    DescribeDocumentClassificationJob

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

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

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

-- | /See:/ 'newDescribeDocumentClassificationJobResponse' smart constructor.
data DescribeDocumentClassificationJobResponse = DescribeDocumentClassificationJobResponse'
  { -- | An object that describes the properties associated with the document
    -- classification job.
    DescribeDocumentClassificationJobResponse
-> Maybe DocumentClassificationJobProperties
documentClassificationJobProperties :: Prelude.Maybe DocumentClassificationJobProperties,
    -- | The response's http status code.
    DescribeDocumentClassificationJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDocumentClassificationJobResponse
-> DescribeDocumentClassificationJobResponse -> Bool
(DescribeDocumentClassificationJobResponse
 -> DescribeDocumentClassificationJobResponse -> Bool)
-> (DescribeDocumentClassificationJobResponse
    -> DescribeDocumentClassificationJobResponse -> Bool)
-> Eq DescribeDocumentClassificationJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDocumentClassificationJobResponse
-> DescribeDocumentClassificationJobResponse -> Bool
$c/= :: DescribeDocumentClassificationJobResponse
-> DescribeDocumentClassificationJobResponse -> Bool
== :: DescribeDocumentClassificationJobResponse
-> DescribeDocumentClassificationJobResponse -> Bool
$c== :: DescribeDocumentClassificationJobResponse
-> DescribeDocumentClassificationJobResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDocumentClassificationJobResponse]
ReadPrec DescribeDocumentClassificationJobResponse
Int -> ReadS DescribeDocumentClassificationJobResponse
ReadS [DescribeDocumentClassificationJobResponse]
(Int -> ReadS DescribeDocumentClassificationJobResponse)
-> ReadS [DescribeDocumentClassificationJobResponse]
-> ReadPrec DescribeDocumentClassificationJobResponse
-> ReadPrec [DescribeDocumentClassificationJobResponse]
-> Read DescribeDocumentClassificationJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDocumentClassificationJobResponse]
$creadListPrec :: ReadPrec [DescribeDocumentClassificationJobResponse]
readPrec :: ReadPrec DescribeDocumentClassificationJobResponse
$creadPrec :: ReadPrec DescribeDocumentClassificationJobResponse
readList :: ReadS [DescribeDocumentClassificationJobResponse]
$creadList :: ReadS [DescribeDocumentClassificationJobResponse]
readsPrec :: Int -> ReadS DescribeDocumentClassificationJobResponse
$creadsPrec :: Int -> ReadS DescribeDocumentClassificationJobResponse
Prelude.Read, Int -> DescribeDocumentClassificationJobResponse -> ShowS
[DescribeDocumentClassificationJobResponse] -> ShowS
DescribeDocumentClassificationJobResponse -> String
(Int -> DescribeDocumentClassificationJobResponse -> ShowS)
-> (DescribeDocumentClassificationJobResponse -> String)
-> ([DescribeDocumentClassificationJobResponse] -> ShowS)
-> Show DescribeDocumentClassificationJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDocumentClassificationJobResponse] -> ShowS
$cshowList :: [DescribeDocumentClassificationJobResponse] -> ShowS
show :: DescribeDocumentClassificationJobResponse -> String
$cshow :: DescribeDocumentClassificationJobResponse -> String
showsPrec :: Int -> DescribeDocumentClassificationJobResponse -> ShowS
$cshowsPrec :: Int -> DescribeDocumentClassificationJobResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDocumentClassificationJobResponse
 -> Rep DescribeDocumentClassificationJobResponse x)
-> (forall x.
    Rep DescribeDocumentClassificationJobResponse x
    -> DescribeDocumentClassificationJobResponse)
-> Generic DescribeDocumentClassificationJobResponse
forall x.
Rep DescribeDocumentClassificationJobResponse x
-> DescribeDocumentClassificationJobResponse
forall x.
DescribeDocumentClassificationJobResponse
-> Rep DescribeDocumentClassificationJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDocumentClassificationJobResponse x
-> DescribeDocumentClassificationJobResponse
$cfrom :: forall x.
DescribeDocumentClassificationJobResponse
-> Rep DescribeDocumentClassificationJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDocumentClassificationJobResponse' 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:
--
-- 'documentClassificationJobProperties', 'describeDocumentClassificationJobResponse_documentClassificationJobProperties' - An object that describes the properties associated with the document
-- classification job.
--
-- 'httpStatus', 'describeDocumentClassificationJobResponse_httpStatus' - The response's http status code.
newDescribeDocumentClassificationJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDocumentClassificationJobResponse
newDescribeDocumentClassificationJobResponse :: Int -> DescribeDocumentClassificationJobResponse
newDescribeDocumentClassificationJobResponse
  Int
pHttpStatus_ =
    DescribeDocumentClassificationJobResponse' :: Maybe DocumentClassificationJobProperties
-> Int -> DescribeDocumentClassificationJobResponse
DescribeDocumentClassificationJobResponse'
      { $sel:documentClassificationJobProperties:DescribeDocumentClassificationJobResponse' :: Maybe DocumentClassificationJobProperties
documentClassificationJobProperties =
          Maybe DocumentClassificationJobProperties
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeDocumentClassificationJobResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | An object that describes the properties associated with the document
-- classification job.
describeDocumentClassificationJobResponse_documentClassificationJobProperties :: Lens.Lens' DescribeDocumentClassificationJobResponse (Prelude.Maybe DocumentClassificationJobProperties)
describeDocumentClassificationJobResponse_documentClassificationJobProperties :: (Maybe DocumentClassificationJobProperties
 -> f (Maybe DocumentClassificationJobProperties))
-> DescribeDocumentClassificationJobResponse
-> f DescribeDocumentClassificationJobResponse
describeDocumentClassificationJobResponse_documentClassificationJobProperties = (DescribeDocumentClassificationJobResponse
 -> Maybe DocumentClassificationJobProperties)
-> (DescribeDocumentClassificationJobResponse
    -> Maybe DocumentClassificationJobProperties
    -> DescribeDocumentClassificationJobResponse)
-> Lens
     DescribeDocumentClassificationJobResponse
     DescribeDocumentClassificationJobResponse
     (Maybe DocumentClassificationJobProperties)
     (Maybe DocumentClassificationJobProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentClassificationJobResponse' {Maybe DocumentClassificationJobProperties
documentClassificationJobProperties :: Maybe DocumentClassificationJobProperties
$sel:documentClassificationJobProperties:DescribeDocumentClassificationJobResponse' :: DescribeDocumentClassificationJobResponse
-> Maybe DocumentClassificationJobProperties
documentClassificationJobProperties} -> Maybe DocumentClassificationJobProperties
documentClassificationJobProperties) (\s :: DescribeDocumentClassificationJobResponse
s@DescribeDocumentClassificationJobResponse' {} Maybe DocumentClassificationJobProperties
a -> DescribeDocumentClassificationJobResponse
s {$sel:documentClassificationJobProperties:DescribeDocumentClassificationJobResponse' :: Maybe DocumentClassificationJobProperties
documentClassificationJobProperties = Maybe DocumentClassificationJobProperties
a} :: DescribeDocumentClassificationJobResponse)

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

instance
  Prelude.NFData
    DescribeDocumentClassificationJobResponse