{-# 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.ComprehendMedical.DescribeRxNormInferenceJob
-- 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 InferRxNorm job. Use this
-- operation to get the status of an inference job.
module Amazonka.ComprehendMedical.DescribeRxNormInferenceJob
  ( -- * Creating a Request
    DescribeRxNormInferenceJob (..),
    newDescribeRxNormInferenceJob,

    -- * Request Lenses
    describeRxNormInferenceJob_jobId,

    -- * Destructuring the Response
    DescribeRxNormInferenceJobResponse (..),
    newDescribeRxNormInferenceJobResponse,

    -- * Response Lenses
    describeRxNormInferenceJobResponse_comprehendMedicalAsyncJobProperties,
    describeRxNormInferenceJobResponse_httpStatus,
  )
where

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

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

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

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

instance Prelude.NFData DescribeRxNormInferenceJob

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

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

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

-- |
-- Create a value of 'DescribeRxNormInferenceJobResponse' 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:
--
-- 'comprehendMedicalAsyncJobProperties', 'describeRxNormInferenceJobResponse_comprehendMedicalAsyncJobProperties' - An object that contains the properties associated with a detection job.
--
-- 'httpStatus', 'describeRxNormInferenceJobResponse_httpStatus' - The response's http status code.
newDescribeRxNormInferenceJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeRxNormInferenceJobResponse
newDescribeRxNormInferenceJobResponse :: Int -> DescribeRxNormInferenceJobResponse
newDescribeRxNormInferenceJobResponse Int
pHttpStatus_ =
  DescribeRxNormInferenceJobResponse' :: Maybe ComprehendMedicalAsyncJobProperties
-> Int -> DescribeRxNormInferenceJobResponse
DescribeRxNormInferenceJobResponse'
    { $sel:comprehendMedicalAsyncJobProperties:DescribeRxNormInferenceJobResponse' :: Maybe ComprehendMedicalAsyncJobProperties
comprehendMedicalAsyncJobProperties =
        Maybe ComprehendMedicalAsyncJobProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeRxNormInferenceJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that contains the properties associated with a detection job.
describeRxNormInferenceJobResponse_comprehendMedicalAsyncJobProperties :: Lens.Lens' DescribeRxNormInferenceJobResponse (Prelude.Maybe ComprehendMedicalAsyncJobProperties)
describeRxNormInferenceJobResponse_comprehendMedicalAsyncJobProperties :: (Maybe ComprehendMedicalAsyncJobProperties
 -> f (Maybe ComprehendMedicalAsyncJobProperties))
-> DescribeRxNormInferenceJobResponse
-> f DescribeRxNormInferenceJobResponse
describeRxNormInferenceJobResponse_comprehendMedicalAsyncJobProperties = (DescribeRxNormInferenceJobResponse
 -> Maybe ComprehendMedicalAsyncJobProperties)
-> (DescribeRxNormInferenceJobResponse
    -> Maybe ComprehendMedicalAsyncJobProperties
    -> DescribeRxNormInferenceJobResponse)
-> Lens
     DescribeRxNormInferenceJobResponse
     DescribeRxNormInferenceJobResponse
     (Maybe ComprehendMedicalAsyncJobProperties)
     (Maybe ComprehendMedicalAsyncJobProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRxNormInferenceJobResponse' {Maybe ComprehendMedicalAsyncJobProperties
comprehendMedicalAsyncJobProperties :: Maybe ComprehendMedicalAsyncJobProperties
$sel:comprehendMedicalAsyncJobProperties:DescribeRxNormInferenceJobResponse' :: DescribeRxNormInferenceJobResponse
-> Maybe ComprehendMedicalAsyncJobProperties
comprehendMedicalAsyncJobProperties} -> Maybe ComprehendMedicalAsyncJobProperties
comprehendMedicalAsyncJobProperties) (\s :: DescribeRxNormInferenceJobResponse
s@DescribeRxNormInferenceJobResponse' {} Maybe ComprehendMedicalAsyncJobProperties
a -> DescribeRxNormInferenceJobResponse
s {$sel:comprehendMedicalAsyncJobProperties:DescribeRxNormInferenceJobResponse' :: Maybe ComprehendMedicalAsyncJobProperties
comprehendMedicalAsyncJobProperties = Maybe ComprehendMedicalAsyncJobProperties
a} :: DescribeRxNormInferenceJobResponse)

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

instance
  Prelude.NFData
    DescribeRxNormInferenceJobResponse