{-# 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.DescribeEntitiesDetectionJob
-- 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 an entities detection job. Use this
-- operation to get the status of a detection job.
module Amazonka.Comprehend.DescribeEntitiesDetectionJob
  ( -- * Creating a Request
    DescribeEntitiesDetectionJob (..),
    newDescribeEntitiesDetectionJob,

    -- * Request Lenses
    describeEntitiesDetectionJob_jobId,

    -- * Destructuring the Response
    DescribeEntitiesDetectionJobResponse (..),
    newDescribeEntitiesDetectionJobResponse,

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

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

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

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

instance Prelude.NFData DescribeEntitiesDetectionJob

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

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

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

-- |
-- Create a value of 'DescribeEntitiesDetectionJobResponse' 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:
--
-- 'entitiesDetectionJobProperties', 'describeEntitiesDetectionJobResponse_entitiesDetectionJobProperties' - An object that contains the properties associated with an entities
-- detection job.
--
-- 'httpStatus', 'describeEntitiesDetectionJobResponse_httpStatus' - The response's http status code.
newDescribeEntitiesDetectionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEntitiesDetectionJobResponse
newDescribeEntitiesDetectionJobResponse :: Int -> DescribeEntitiesDetectionJobResponse
newDescribeEntitiesDetectionJobResponse Int
pHttpStatus_ =
  DescribeEntitiesDetectionJobResponse' :: Maybe EntitiesDetectionJobProperties
-> Int -> DescribeEntitiesDetectionJobResponse
DescribeEntitiesDetectionJobResponse'
    { $sel:entitiesDetectionJobProperties:DescribeEntitiesDetectionJobResponse' :: Maybe EntitiesDetectionJobProperties
entitiesDetectionJobProperties =
        Maybe EntitiesDetectionJobProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeEntitiesDetectionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that contains the properties associated with an entities
-- detection job.
describeEntitiesDetectionJobResponse_entitiesDetectionJobProperties :: Lens.Lens' DescribeEntitiesDetectionJobResponse (Prelude.Maybe EntitiesDetectionJobProperties)
describeEntitiesDetectionJobResponse_entitiesDetectionJobProperties :: (Maybe EntitiesDetectionJobProperties
 -> f (Maybe EntitiesDetectionJobProperties))
-> DescribeEntitiesDetectionJobResponse
-> f DescribeEntitiesDetectionJobResponse
describeEntitiesDetectionJobResponse_entitiesDetectionJobProperties = (DescribeEntitiesDetectionJobResponse
 -> Maybe EntitiesDetectionJobProperties)
-> (DescribeEntitiesDetectionJobResponse
    -> Maybe EntitiesDetectionJobProperties
    -> DescribeEntitiesDetectionJobResponse)
-> Lens
     DescribeEntitiesDetectionJobResponse
     DescribeEntitiesDetectionJobResponse
     (Maybe EntitiesDetectionJobProperties)
     (Maybe EntitiesDetectionJobProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEntitiesDetectionJobResponse' {Maybe EntitiesDetectionJobProperties
entitiesDetectionJobProperties :: Maybe EntitiesDetectionJobProperties
$sel:entitiesDetectionJobProperties:DescribeEntitiesDetectionJobResponse' :: DescribeEntitiesDetectionJobResponse
-> Maybe EntitiesDetectionJobProperties
entitiesDetectionJobProperties} -> Maybe EntitiesDetectionJobProperties
entitiesDetectionJobProperties) (\s :: DescribeEntitiesDetectionJobResponse
s@DescribeEntitiesDetectionJobResponse' {} Maybe EntitiesDetectionJobProperties
a -> DescribeEntitiesDetectionJobResponse
s {$sel:entitiesDetectionJobProperties:DescribeEntitiesDetectionJobResponse' :: Maybe EntitiesDetectionJobProperties
entitiesDetectionJobProperties = Maybe EntitiesDetectionJobProperties
a} :: DescribeEntitiesDetectionJobResponse)

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

instance
  Prelude.NFData
    DescribeEntitiesDetectionJobResponse