{-# 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.DescribeTargetedSentimentDetectionJob
-- 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 targeted sentiment detection job.
-- Use this operation to get the status of the job.
module Amazonka.Comprehend.DescribeTargetedSentimentDetectionJob
  ( -- * Creating a Request
    DescribeTargetedSentimentDetectionJob (..),
    newDescribeTargetedSentimentDetectionJob,

    -- * Request Lenses
    describeTargetedSentimentDetectionJob_jobId,

    -- * Destructuring the Response
    DescribeTargetedSentimentDetectionJobResponse (..),
    newDescribeTargetedSentimentDetectionJobResponse,

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

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

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

instance
  Core.AWSRequest
    DescribeTargetedSentimentDetectionJob
  where
  type
    AWSResponse
      DescribeTargetedSentimentDetectionJob =
      DescribeTargetedSentimentDetectionJobResponse
  request :: (Service -> Service)
-> DescribeTargetedSentimentDetectionJob
-> Request DescribeTargetedSentimentDetectionJob
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 DescribeTargetedSentimentDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeTargetedSentimentDetectionJob)))
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 TargetedSentimentDetectionJobProperties
-> Int -> DescribeTargetedSentimentDetectionJobResponse
DescribeTargetedSentimentDetectionJobResponse'
            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
"TargetedSentimentDetectionJobProperties"
                        )
            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
    DescribeTargetedSentimentDetectionJob
  where
  hashWithSalt :: Int -> DescribeTargetedSentimentDetectionJob -> Int
hashWithSalt
    Int
_salt
    DescribeTargetedSentimentDetectionJob' {Text
jobId :: Text
$sel:jobId:DescribeTargetedSentimentDetectionJob' :: DescribeTargetedSentimentDetectionJob -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId

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

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

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

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

-- |
-- Create a value of 'DescribeTargetedSentimentDetectionJobResponse' 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:
--
-- 'targetedSentimentDetectionJobProperties', 'describeTargetedSentimentDetectionJobResponse_targetedSentimentDetectionJobProperties' - An object that contains the properties associated with a targeted
-- sentiment detection job.
--
-- 'httpStatus', 'describeTargetedSentimentDetectionJobResponse_httpStatus' - The response's http status code.
newDescribeTargetedSentimentDetectionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTargetedSentimentDetectionJobResponse
newDescribeTargetedSentimentDetectionJobResponse :: Int -> DescribeTargetedSentimentDetectionJobResponse
newDescribeTargetedSentimentDetectionJobResponse
  Int
pHttpStatus_ =
    DescribeTargetedSentimentDetectionJobResponse'
      { $sel:targetedSentimentDetectionJobProperties:DescribeTargetedSentimentDetectionJobResponse' :: Maybe TargetedSentimentDetectionJobProperties
targetedSentimentDetectionJobProperties =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeTargetedSentimentDetectionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | An object that contains the properties associated with a targeted
-- sentiment detection job.
describeTargetedSentimentDetectionJobResponse_targetedSentimentDetectionJobProperties :: Lens.Lens' DescribeTargetedSentimentDetectionJobResponse (Prelude.Maybe TargetedSentimentDetectionJobProperties)
describeTargetedSentimentDetectionJobResponse_targetedSentimentDetectionJobProperties :: Lens'
  DescribeTargetedSentimentDetectionJobResponse
  (Maybe TargetedSentimentDetectionJobProperties)
describeTargetedSentimentDetectionJobResponse_targetedSentimentDetectionJobProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTargetedSentimentDetectionJobResponse' {Maybe TargetedSentimentDetectionJobProperties
targetedSentimentDetectionJobProperties :: Maybe TargetedSentimentDetectionJobProperties
$sel:targetedSentimentDetectionJobProperties:DescribeTargetedSentimentDetectionJobResponse' :: DescribeTargetedSentimentDetectionJobResponse
-> Maybe TargetedSentimentDetectionJobProperties
targetedSentimentDetectionJobProperties} -> Maybe TargetedSentimentDetectionJobProperties
targetedSentimentDetectionJobProperties) (\s :: DescribeTargetedSentimentDetectionJobResponse
s@DescribeTargetedSentimentDetectionJobResponse' {} Maybe TargetedSentimentDetectionJobProperties
a -> DescribeTargetedSentimentDetectionJobResponse
s {$sel:targetedSentimentDetectionJobProperties:DescribeTargetedSentimentDetectionJobResponse' :: Maybe TargetedSentimentDetectionJobProperties
targetedSentimentDetectionJobProperties = Maybe TargetedSentimentDetectionJobProperties
a} :: DescribeTargetedSentimentDetectionJobResponse)

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

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