{-# 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-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 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.Lens as Lens
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
(DescribeTopicsDetectionJob -> DescribeTopicsDetectionJob -> Bool)
-> (DescribeTopicsDetectionJob
    -> DescribeTopicsDetectionJob -> Bool)
-> Eq DescribeTopicsDetectionJob
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]
(Int -> ReadS DescribeTopicsDetectionJob)
-> ReadS [DescribeTopicsDetectionJob]
-> ReadPrec DescribeTopicsDetectionJob
-> ReadPrec [DescribeTopicsDetectionJob]
-> Read 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
(Int -> DescribeTopicsDetectionJob -> ShowS)
-> (DescribeTopicsDetectionJob -> String)
-> ([DescribeTopicsDetectionJob] -> ShowS)
-> Show DescribeTopicsDetectionJob
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.
 DescribeTopicsDetectionJob -> Rep DescribeTopicsDetectionJob x)
-> (forall x.
    Rep DescribeTopicsDetectionJob x -> DescribeTopicsDetectionJob)
-> Generic DescribeTopicsDetectionJob
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' :: Text -> DescribeTopicsDetectionJob
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 :: (Text -> f Text)
-> DescribeTopicsDetectionJob -> f DescribeTopicsDetectionJob
describeTopicsDetectionJob_jobId = (DescribeTopicsDetectionJob -> Text)
-> (DescribeTopicsDetectionJob
    -> Text -> DescribeTopicsDetectionJob)
-> Lens
     DescribeTopicsDetectionJob DescribeTopicsDetectionJob Text Text
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 :: DescribeTopicsDetectionJob -> Request DescribeTopicsDetectionJob
request = Service
-> DescribeTopicsDetectionJob -> Request DescribeTopicsDetectionJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeTopicsDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeTopicsDetectionJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeTopicsDetectionJob))
-> Logger
-> Service
-> Proxy DescribeTopicsDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeTopicsDetectionJob)))
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 TopicsDetectionJobProperties
-> Int -> DescribeTopicsDetectionJobResponse
DescribeTopicsDetectionJobResponse'
            (Maybe TopicsDetectionJobProperties
 -> Int -> DescribeTopicsDetectionJobResponse)
-> Either String (Maybe TopicsDetectionJobProperties)
-> Either String (Int -> DescribeTopicsDetectionJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe TopicsDetectionJobProperties)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TopicsDetectionJobProperties")
            Either String (Int -> DescribeTopicsDetectionJobResponse)
-> Either String Int
-> Either String DescribeTopicsDetectionJobResponse
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 DescribeTopicsDetectionJob

instance Prelude.NFData DescribeTopicsDetectionJob

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

instance Core.ToQuery DescribeTopicsDetectionJob where
  toQuery :: DescribeTopicsDetectionJob -> QueryString
toQuery = QueryString -> DescribeTopicsDetectionJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DescribeTopicsDetectionJobResponse
 -> DescribeTopicsDetectionJobResponse -> Bool)
-> (DescribeTopicsDetectionJobResponse
    -> DescribeTopicsDetectionJobResponse -> Bool)
-> Eq DescribeTopicsDetectionJobResponse
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]
(Int -> ReadS DescribeTopicsDetectionJobResponse)
-> ReadS [DescribeTopicsDetectionJobResponse]
-> ReadPrec DescribeTopicsDetectionJobResponse
-> ReadPrec [DescribeTopicsDetectionJobResponse]
-> Read 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
(Int -> DescribeTopicsDetectionJobResponse -> ShowS)
-> (DescribeTopicsDetectionJobResponse -> String)
-> ([DescribeTopicsDetectionJobResponse] -> ShowS)
-> Show DescribeTopicsDetectionJobResponse
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.
 DescribeTopicsDetectionJobResponse
 -> Rep DescribeTopicsDetectionJobResponse x)
-> (forall x.
    Rep DescribeTopicsDetectionJobResponse x
    -> DescribeTopicsDetectionJobResponse)
-> Generic DescribeTopicsDetectionJobResponse
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' :: Maybe TopicsDetectionJobProperties
-> Int -> DescribeTopicsDetectionJobResponse
DescribeTopicsDetectionJobResponse'
    { $sel:topicsDetectionJobProperties:DescribeTopicsDetectionJobResponse' :: Maybe TopicsDetectionJobProperties
topicsDetectionJobProperties =
        Maybe 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 :: (Maybe TopicsDetectionJobProperties
 -> f (Maybe TopicsDetectionJobProperties))
-> DescribeTopicsDetectionJobResponse
-> f DescribeTopicsDetectionJobResponse
describeTopicsDetectionJobResponse_topicsDetectionJobProperties = (DescribeTopicsDetectionJobResponse
 -> Maybe TopicsDetectionJobProperties)
-> (DescribeTopicsDetectionJobResponse
    -> Maybe TopicsDetectionJobProperties
    -> DescribeTopicsDetectionJobResponse)
-> Lens
     DescribeTopicsDetectionJobResponse
     DescribeTopicsDetectionJobResponse
     (Maybe TopicsDetectionJobProperties)
     (Maybe 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 :: (Int -> f Int)
-> DescribeTopicsDetectionJobResponse
-> f DescribeTopicsDetectionJobResponse
describeTopicsDetectionJobResponse_httpStatus = (DescribeTopicsDetectionJobResponse -> Int)
-> (DescribeTopicsDetectionJobResponse
    -> Int -> DescribeTopicsDetectionJobResponse)
-> Lens
     DescribeTopicsDetectionJobResponse
     DescribeTopicsDetectionJobResponse
     Int
     Int
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