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

    -- * Request Lenses
    describeICD10CMInferenceJob_jobId,

    -- * Destructuring the Response
    DescribeICD10CMInferenceJobResponse (..),
    newDescribeICD10CMInferenceJobResponse,

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

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

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

instance Core.AWSRequest DescribeICD10CMInferenceJob where
  type
    AWSResponse DescribeICD10CMInferenceJob =
      DescribeICD10CMInferenceJobResponse
  request :: DescribeICD10CMInferenceJob -> Request DescribeICD10CMInferenceJob
request = Service
-> DescribeICD10CMInferenceJob
-> Request DescribeICD10CMInferenceJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeICD10CMInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeICD10CMInferenceJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeICD10CMInferenceJob))
-> Logger
-> Service
-> Proxy DescribeICD10CMInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeICD10CMInferenceJob)))
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 -> DescribeICD10CMInferenceJobResponse
DescribeICD10CMInferenceJobResponse'
            (Maybe ComprehendMedicalAsyncJobProperties
 -> Int -> DescribeICD10CMInferenceJobResponse)
-> Either String (Maybe ComprehendMedicalAsyncJobProperties)
-> Either String (Int -> DescribeICD10CMInferenceJobResponse)
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 -> DescribeICD10CMInferenceJobResponse)
-> Either String Int
-> Either String DescribeICD10CMInferenceJobResponse
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 DescribeICD10CMInferenceJob

instance Prelude.NFData DescribeICD10CMInferenceJob

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

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

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

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

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

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

instance
  Prelude.NFData
    DescribeICD10CMInferenceJobResponse