{-# 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.DescribeTopicsDetectionJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the properties associated with a topic detection job. Use this
-- operation to get the status of a detection job.
module Amazonka.Comprehend.DescribeTopicsDetectionJob
  ( -- * Creating a Request
    DescribeTopicsDetectionJob (..),
    newDescribeTopicsDetectionJob,

    -- * Request Lenses
    describeTopicsDetectionJob_jobId,

    -- * Destructuring the Response
    DescribeTopicsDetectionJobResponse (..),
    newDescribeTopicsDetectionJobResponse,

    -- * Response Lenses
    describeTopicsDetectionJobResponse_topicsDetectionJobProperties,
    describeTopicsDetectionJobResponse_httpStatus,
  )
where

import Amazonka.Comprehend.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeTopicsDetectionJob' smart constructor.
data DescribeTopicsDetectionJob = DescribeTopicsDetectionJob'
  { -- | The identifier assigned by the user to the detection job.
    DescribeTopicsDetectionJob -> Text
jobId :: Prelude.Text
  }
  deriving (DescribeTopicsDetectionJob -> DescribeTopicsDetectionJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTopicsDetectionJob -> DescribeTopicsDetectionJob -> Bool
$c/= :: DescribeTopicsDetectionJob -> DescribeTopicsDetectionJob -> Bool
== :: DescribeTopicsDetectionJob -> DescribeTopicsDetectionJob -> Bool
$c== :: DescribeTopicsDetectionJob -> DescribeTopicsDetectionJob -> Bool
Prelude.Eq, ReadPrec [DescribeTopicsDetectionJob]
ReadPrec DescribeTopicsDetectionJob
Int -> ReadS DescribeTopicsDetectionJob
ReadS [DescribeTopicsDetectionJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTopicsDetectionJob]
$creadListPrec :: ReadPrec [DescribeTopicsDetectionJob]
readPrec :: ReadPrec DescribeTopicsDetectionJob
$creadPrec :: ReadPrec DescribeTopicsDetectionJob
readList :: ReadS [DescribeTopicsDetectionJob]
$creadList :: ReadS [DescribeTopicsDetectionJob]
readsPrec :: Int -> ReadS DescribeTopicsDetectionJob
$creadsPrec :: Int -> ReadS DescribeTopicsDetectionJob
Prelude.Read, Int -> DescribeTopicsDetectionJob -> ShowS
[DescribeTopicsDetectionJob] -> ShowS
DescribeTopicsDetectionJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTopicsDetectionJob] -> ShowS
$cshowList :: [DescribeTopicsDetectionJob] -> ShowS
show :: DescribeTopicsDetectionJob -> String
$cshow :: DescribeTopicsDetectionJob -> String
showsPrec :: Int -> DescribeTopicsDetectionJob -> ShowS
$cshowsPrec :: Int -> DescribeTopicsDetectionJob -> ShowS
Prelude.Show, forall x.
Rep DescribeTopicsDetectionJob x -> DescribeTopicsDetectionJob
forall x.
DescribeTopicsDetectionJob -> Rep DescribeTopicsDetectionJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTopicsDetectionJob x -> DescribeTopicsDetectionJob
$cfrom :: forall x.
DescribeTopicsDetectionJob -> Rep DescribeTopicsDetectionJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTopicsDetectionJob' 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', 'describeTopicsDetectionJob_jobId' - The identifier assigned by the user to the detection job.
newDescribeTopicsDetectionJob ::
  -- | 'jobId'
  Prelude.Text ->
  DescribeTopicsDetectionJob
newDescribeTopicsDetectionJob :: Text -> DescribeTopicsDetectionJob
newDescribeTopicsDetectionJob Text
pJobId_ =
  DescribeTopicsDetectionJob' {$sel:jobId:DescribeTopicsDetectionJob' :: Text
jobId = Text
pJobId_}

-- | The identifier assigned by the user to the detection job.
describeTopicsDetectionJob_jobId :: Lens.Lens' DescribeTopicsDetectionJob Prelude.Text
describeTopicsDetectionJob_jobId :: Lens' DescribeTopicsDetectionJob Text
describeTopicsDetectionJob_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTopicsDetectionJob' {Text
jobId :: Text
$sel:jobId:DescribeTopicsDetectionJob' :: DescribeTopicsDetectionJob -> Text
jobId} -> Text
jobId) (\s :: DescribeTopicsDetectionJob
s@DescribeTopicsDetectionJob' {} Text
a -> DescribeTopicsDetectionJob
s {$sel:jobId:DescribeTopicsDetectionJob' :: Text
jobId = Text
a} :: DescribeTopicsDetectionJob)

instance Core.AWSRequest DescribeTopicsDetectionJob where
  type
    AWSResponse DescribeTopicsDetectionJob =
      DescribeTopicsDetectionJobResponse
  request :: (Service -> Service)
-> DescribeTopicsDetectionJob -> Request DescribeTopicsDetectionJob
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeTopicsDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeTopicsDetectionJob)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe TopicsDetectionJobProperties
-> Int -> DescribeTopicsDetectionJobResponse
DescribeTopicsDetectionJobResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"TopicsDetectionJobProperties")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeTopicsDetectionJob where
  hashWithSalt :: Int -> DescribeTopicsDetectionJob -> Int
hashWithSalt Int
_salt DescribeTopicsDetectionJob' {Text
jobId :: Text
$sel:jobId:DescribeTopicsDetectionJob' :: DescribeTopicsDetectionJob -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId

instance Prelude.NFData DescribeTopicsDetectionJob where
  rnf :: DescribeTopicsDetectionJob -> ()
rnf DescribeTopicsDetectionJob' {Text
jobId :: Text
$sel:jobId:DescribeTopicsDetectionJob' :: DescribeTopicsDetectionJob -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
jobId

instance Data.ToHeaders DescribeTopicsDetectionJob where
  toHeaders :: DescribeTopicsDetectionJob -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Comprehend_20171127.DescribeTopicsDetectionJob" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DescribeTopicsDetectionJob where
  toJSON :: DescribeTopicsDetectionJob -> Value
toJSON DescribeTopicsDetectionJob' {Text
jobId :: Text
$sel:jobId:DescribeTopicsDetectionJob' :: DescribeTopicsDetectionJob -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"JobId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
jobId)]
      )

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

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

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

-- |
-- Create a value of 'DescribeTopicsDetectionJobResponse' 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:
--
-- 'topicsDetectionJobProperties', 'describeTopicsDetectionJobResponse_topicsDetectionJobProperties' - The list of properties for the requested job.
--
-- 'httpStatus', 'describeTopicsDetectionJobResponse_httpStatus' - The response's http status code.
newDescribeTopicsDetectionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTopicsDetectionJobResponse
newDescribeTopicsDetectionJobResponse :: Int -> DescribeTopicsDetectionJobResponse
newDescribeTopicsDetectionJobResponse Int
pHttpStatus_ =
  DescribeTopicsDetectionJobResponse'
    { $sel:topicsDetectionJobProperties:DescribeTopicsDetectionJobResponse' :: Maybe TopicsDetectionJobProperties
topicsDetectionJobProperties =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeTopicsDetectionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of properties for the requested job.
describeTopicsDetectionJobResponse_topicsDetectionJobProperties :: Lens.Lens' DescribeTopicsDetectionJobResponse (Prelude.Maybe TopicsDetectionJobProperties)
describeTopicsDetectionJobResponse_topicsDetectionJobProperties :: Lens'
  DescribeTopicsDetectionJobResponse
  (Maybe TopicsDetectionJobProperties)
describeTopicsDetectionJobResponse_topicsDetectionJobProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTopicsDetectionJobResponse' {Maybe TopicsDetectionJobProperties
topicsDetectionJobProperties :: Maybe TopicsDetectionJobProperties
$sel:topicsDetectionJobProperties:DescribeTopicsDetectionJobResponse' :: DescribeTopicsDetectionJobResponse
-> Maybe TopicsDetectionJobProperties
topicsDetectionJobProperties} -> Maybe TopicsDetectionJobProperties
topicsDetectionJobProperties) (\s :: DescribeTopicsDetectionJobResponse
s@DescribeTopicsDetectionJobResponse' {} Maybe TopicsDetectionJobProperties
a -> DescribeTopicsDetectionJobResponse
s {$sel:topicsDetectionJobProperties:DescribeTopicsDetectionJobResponse' :: Maybe TopicsDetectionJobProperties
topicsDetectionJobProperties = Maybe TopicsDetectionJobProperties
a} :: DescribeTopicsDetectionJobResponse)

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

instance
  Prelude.NFData
    DescribeTopicsDetectionJobResponse
  where
  rnf :: DescribeTopicsDetectionJobResponse -> ()
rnf DescribeTopicsDetectionJobResponse' {Int
Maybe TopicsDetectionJobProperties
httpStatus :: Int
topicsDetectionJobProperties :: Maybe TopicsDetectionJobProperties
$sel:httpStatus:DescribeTopicsDetectionJobResponse' :: DescribeTopicsDetectionJobResponse -> Int
$sel:topicsDetectionJobProperties:DescribeTopicsDetectionJobResponse' :: DescribeTopicsDetectionJobResponse
-> Maybe TopicsDetectionJobProperties
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TopicsDetectionJobProperties
topicsDetectionJobProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus