{-# 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.DescribePHIDetectionJob
-- 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 protected health information (PHI)
-- detection job. Use this operation to get the status of a detection job.
module Amazonka.ComprehendMedical.DescribePHIDetectionJob
  ( -- * Creating a Request
    DescribePHIDetectionJob (..),
    newDescribePHIDetectionJob,

    -- * Request Lenses
    describePHIDetectionJob_jobId,

    -- * Destructuring the Response
    DescribePHIDetectionJobResponse (..),
    newDescribePHIDetectionJobResponse,

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

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

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

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

instance Prelude.NFData DescribePHIDetectionJob

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

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

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

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

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

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

instance
  Prelude.NFData
    DescribePHIDetectionJobResponse