{-# 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.HealthLake.DescribeFHIRImportJob
-- 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)
--
-- Displays the properties of a FHIR import job, including the ID, ARN,
-- name, and the status of the job.
module Amazonka.HealthLake.DescribeFHIRImportJob
  ( -- * Creating a Request
    DescribeFHIRImportJob (..),
    newDescribeFHIRImportJob,

    -- * Request Lenses
    describeFHIRImportJob_datastoreId,
    describeFHIRImportJob_jobId,

    -- * Destructuring the Response
    DescribeFHIRImportJobResponse (..),
    newDescribeFHIRImportJobResponse,

    -- * Response Lenses
    describeFHIRImportJobResponse_httpStatus,
    describeFHIRImportJobResponse_importJobProperties,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.HealthLake.Types
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:/ 'newDescribeFHIRImportJob' smart constructor.
data DescribeFHIRImportJob = DescribeFHIRImportJob'
  { -- | The AWS-generated ID of the Data Store.
    DescribeFHIRImportJob -> Text
datastoreId :: Prelude.Text,
    -- | The AWS-generated job ID.
    DescribeFHIRImportJob -> Text
jobId :: Prelude.Text
  }
  deriving (DescribeFHIRImportJob -> DescribeFHIRImportJob -> Bool
(DescribeFHIRImportJob -> DescribeFHIRImportJob -> Bool)
-> (DescribeFHIRImportJob -> DescribeFHIRImportJob -> Bool)
-> Eq DescribeFHIRImportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFHIRImportJob -> DescribeFHIRImportJob -> Bool
$c/= :: DescribeFHIRImportJob -> DescribeFHIRImportJob -> Bool
== :: DescribeFHIRImportJob -> DescribeFHIRImportJob -> Bool
$c== :: DescribeFHIRImportJob -> DescribeFHIRImportJob -> Bool
Prelude.Eq, ReadPrec [DescribeFHIRImportJob]
ReadPrec DescribeFHIRImportJob
Int -> ReadS DescribeFHIRImportJob
ReadS [DescribeFHIRImportJob]
(Int -> ReadS DescribeFHIRImportJob)
-> ReadS [DescribeFHIRImportJob]
-> ReadPrec DescribeFHIRImportJob
-> ReadPrec [DescribeFHIRImportJob]
-> Read DescribeFHIRImportJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFHIRImportJob]
$creadListPrec :: ReadPrec [DescribeFHIRImportJob]
readPrec :: ReadPrec DescribeFHIRImportJob
$creadPrec :: ReadPrec DescribeFHIRImportJob
readList :: ReadS [DescribeFHIRImportJob]
$creadList :: ReadS [DescribeFHIRImportJob]
readsPrec :: Int -> ReadS DescribeFHIRImportJob
$creadsPrec :: Int -> ReadS DescribeFHIRImportJob
Prelude.Read, Int -> DescribeFHIRImportJob -> ShowS
[DescribeFHIRImportJob] -> ShowS
DescribeFHIRImportJob -> String
(Int -> DescribeFHIRImportJob -> ShowS)
-> (DescribeFHIRImportJob -> String)
-> ([DescribeFHIRImportJob] -> ShowS)
-> Show DescribeFHIRImportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFHIRImportJob] -> ShowS
$cshowList :: [DescribeFHIRImportJob] -> ShowS
show :: DescribeFHIRImportJob -> String
$cshow :: DescribeFHIRImportJob -> String
showsPrec :: Int -> DescribeFHIRImportJob -> ShowS
$cshowsPrec :: Int -> DescribeFHIRImportJob -> ShowS
Prelude.Show, (forall x. DescribeFHIRImportJob -> Rep DescribeFHIRImportJob x)
-> (forall x. Rep DescribeFHIRImportJob x -> DescribeFHIRImportJob)
-> Generic DescribeFHIRImportJob
forall x. Rep DescribeFHIRImportJob x -> DescribeFHIRImportJob
forall x. DescribeFHIRImportJob -> Rep DescribeFHIRImportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFHIRImportJob x -> DescribeFHIRImportJob
$cfrom :: forall x. DescribeFHIRImportJob -> Rep DescribeFHIRImportJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFHIRImportJob' 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:
--
-- 'datastoreId', 'describeFHIRImportJob_datastoreId' - The AWS-generated ID of the Data Store.
--
-- 'jobId', 'describeFHIRImportJob_jobId' - The AWS-generated job ID.
newDescribeFHIRImportJob ::
  -- | 'datastoreId'
  Prelude.Text ->
  -- | 'jobId'
  Prelude.Text ->
  DescribeFHIRImportJob
newDescribeFHIRImportJob :: Text -> Text -> DescribeFHIRImportJob
newDescribeFHIRImportJob Text
pDatastoreId_ Text
pJobId_ =
  DescribeFHIRImportJob' :: Text -> Text -> DescribeFHIRImportJob
DescribeFHIRImportJob'
    { $sel:datastoreId:DescribeFHIRImportJob' :: Text
datastoreId = Text
pDatastoreId_,
      $sel:jobId:DescribeFHIRImportJob' :: Text
jobId = Text
pJobId_
    }

-- | The AWS-generated ID of the Data Store.
describeFHIRImportJob_datastoreId :: Lens.Lens' DescribeFHIRImportJob Prelude.Text
describeFHIRImportJob_datastoreId :: (Text -> f Text)
-> DescribeFHIRImportJob -> f DescribeFHIRImportJob
describeFHIRImportJob_datastoreId = (DescribeFHIRImportJob -> Text)
-> (DescribeFHIRImportJob -> Text -> DescribeFHIRImportJob)
-> Lens DescribeFHIRImportJob DescribeFHIRImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFHIRImportJob' {Text
datastoreId :: Text
$sel:datastoreId:DescribeFHIRImportJob' :: DescribeFHIRImportJob -> Text
datastoreId} -> Text
datastoreId) (\s :: DescribeFHIRImportJob
s@DescribeFHIRImportJob' {} Text
a -> DescribeFHIRImportJob
s {$sel:datastoreId:DescribeFHIRImportJob' :: Text
datastoreId = Text
a} :: DescribeFHIRImportJob)

-- | The AWS-generated job ID.
describeFHIRImportJob_jobId :: Lens.Lens' DescribeFHIRImportJob Prelude.Text
describeFHIRImportJob_jobId :: (Text -> f Text)
-> DescribeFHIRImportJob -> f DescribeFHIRImportJob
describeFHIRImportJob_jobId = (DescribeFHIRImportJob -> Text)
-> (DescribeFHIRImportJob -> Text -> DescribeFHIRImportJob)
-> Lens DescribeFHIRImportJob DescribeFHIRImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFHIRImportJob' {Text
jobId :: Text
$sel:jobId:DescribeFHIRImportJob' :: DescribeFHIRImportJob -> Text
jobId} -> Text
jobId) (\s :: DescribeFHIRImportJob
s@DescribeFHIRImportJob' {} Text
a -> DescribeFHIRImportJob
s {$sel:jobId:DescribeFHIRImportJob' :: Text
jobId = Text
a} :: DescribeFHIRImportJob)

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

instance Prelude.Hashable DescribeFHIRImportJob

instance Prelude.NFData DescribeFHIRImportJob

instance Core.ToHeaders DescribeFHIRImportJob where
  toHeaders :: DescribeFHIRImportJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeFHIRImportJob -> 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
"HealthLake.DescribeFHIRImportJob" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeFHIRImportJob where
  toJSON :: DescribeFHIRImportJob -> Value
toJSON DescribeFHIRImportJob' {Text
jobId :: Text
datastoreId :: Text
$sel:jobId:DescribeFHIRImportJob' :: DescribeFHIRImportJob -> Text
$sel:datastoreId:DescribeFHIRImportJob' :: DescribeFHIRImportJob -> 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
"DatastoreId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datastoreId),
            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 DescribeFHIRImportJob where
  toPath :: DescribeFHIRImportJob -> ByteString
toPath = ByteString -> DescribeFHIRImportJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDescribeFHIRImportJobResponse' smart constructor.
data DescribeFHIRImportJobResponse = DescribeFHIRImportJobResponse'
  { -- | The response's http status code.
    DescribeFHIRImportJobResponse -> Int
httpStatus :: Prelude.Int,
    -- | The properties of the Import job request, including the ID, ARN, name,
    -- and the status of the job.
    DescribeFHIRImportJobResponse -> ImportJobProperties
importJobProperties :: ImportJobProperties
  }
  deriving (DescribeFHIRImportJobResponse
-> DescribeFHIRImportJobResponse -> Bool
(DescribeFHIRImportJobResponse
 -> DescribeFHIRImportJobResponse -> Bool)
-> (DescribeFHIRImportJobResponse
    -> DescribeFHIRImportJobResponse -> Bool)
-> Eq DescribeFHIRImportJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFHIRImportJobResponse
-> DescribeFHIRImportJobResponse -> Bool
$c/= :: DescribeFHIRImportJobResponse
-> DescribeFHIRImportJobResponse -> Bool
== :: DescribeFHIRImportJobResponse
-> DescribeFHIRImportJobResponse -> Bool
$c== :: DescribeFHIRImportJobResponse
-> DescribeFHIRImportJobResponse -> Bool
Prelude.Eq, ReadPrec [DescribeFHIRImportJobResponse]
ReadPrec DescribeFHIRImportJobResponse
Int -> ReadS DescribeFHIRImportJobResponse
ReadS [DescribeFHIRImportJobResponse]
(Int -> ReadS DescribeFHIRImportJobResponse)
-> ReadS [DescribeFHIRImportJobResponse]
-> ReadPrec DescribeFHIRImportJobResponse
-> ReadPrec [DescribeFHIRImportJobResponse]
-> Read DescribeFHIRImportJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFHIRImportJobResponse]
$creadListPrec :: ReadPrec [DescribeFHIRImportJobResponse]
readPrec :: ReadPrec DescribeFHIRImportJobResponse
$creadPrec :: ReadPrec DescribeFHIRImportJobResponse
readList :: ReadS [DescribeFHIRImportJobResponse]
$creadList :: ReadS [DescribeFHIRImportJobResponse]
readsPrec :: Int -> ReadS DescribeFHIRImportJobResponse
$creadsPrec :: Int -> ReadS DescribeFHIRImportJobResponse
Prelude.Read, Int -> DescribeFHIRImportJobResponse -> ShowS
[DescribeFHIRImportJobResponse] -> ShowS
DescribeFHIRImportJobResponse -> String
(Int -> DescribeFHIRImportJobResponse -> ShowS)
-> (DescribeFHIRImportJobResponse -> String)
-> ([DescribeFHIRImportJobResponse] -> ShowS)
-> Show DescribeFHIRImportJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFHIRImportJobResponse] -> ShowS
$cshowList :: [DescribeFHIRImportJobResponse] -> ShowS
show :: DescribeFHIRImportJobResponse -> String
$cshow :: DescribeFHIRImportJobResponse -> String
showsPrec :: Int -> DescribeFHIRImportJobResponse -> ShowS
$cshowsPrec :: Int -> DescribeFHIRImportJobResponse -> ShowS
Prelude.Show, (forall x.
 DescribeFHIRImportJobResponse
 -> Rep DescribeFHIRImportJobResponse x)
-> (forall x.
    Rep DescribeFHIRImportJobResponse x
    -> DescribeFHIRImportJobResponse)
-> Generic DescribeFHIRImportJobResponse
forall x.
Rep DescribeFHIRImportJobResponse x
-> DescribeFHIRImportJobResponse
forall x.
DescribeFHIRImportJobResponse
-> Rep DescribeFHIRImportJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeFHIRImportJobResponse x
-> DescribeFHIRImportJobResponse
$cfrom :: forall x.
DescribeFHIRImportJobResponse
-> Rep DescribeFHIRImportJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFHIRImportJobResponse' 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:
--
-- 'httpStatus', 'describeFHIRImportJobResponse_httpStatus' - The response's http status code.
--
-- 'importJobProperties', 'describeFHIRImportJobResponse_importJobProperties' - The properties of the Import job request, including the ID, ARN, name,
-- and the status of the job.
newDescribeFHIRImportJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'importJobProperties'
  ImportJobProperties ->
  DescribeFHIRImportJobResponse
newDescribeFHIRImportJobResponse :: Int -> ImportJobProperties -> DescribeFHIRImportJobResponse
newDescribeFHIRImportJobResponse
  Int
pHttpStatus_
  ImportJobProperties
pImportJobProperties_ =
    DescribeFHIRImportJobResponse' :: Int -> ImportJobProperties -> DescribeFHIRImportJobResponse
DescribeFHIRImportJobResponse'
      { $sel:httpStatus:DescribeFHIRImportJobResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:importJobProperties:DescribeFHIRImportJobResponse' :: ImportJobProperties
importJobProperties = ImportJobProperties
pImportJobProperties_
      }

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

-- | The properties of the Import job request, including the ID, ARN, name,
-- and the status of the job.
describeFHIRImportJobResponse_importJobProperties :: Lens.Lens' DescribeFHIRImportJobResponse ImportJobProperties
describeFHIRImportJobResponse_importJobProperties :: (ImportJobProperties -> f ImportJobProperties)
-> DescribeFHIRImportJobResponse -> f DescribeFHIRImportJobResponse
describeFHIRImportJobResponse_importJobProperties = (DescribeFHIRImportJobResponse -> ImportJobProperties)
-> (DescribeFHIRImportJobResponse
    -> ImportJobProperties -> DescribeFHIRImportJobResponse)
-> Lens
     DescribeFHIRImportJobResponse
     DescribeFHIRImportJobResponse
     ImportJobProperties
     ImportJobProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFHIRImportJobResponse' {ImportJobProperties
importJobProperties :: ImportJobProperties
$sel:importJobProperties:DescribeFHIRImportJobResponse' :: DescribeFHIRImportJobResponse -> ImportJobProperties
importJobProperties} -> ImportJobProperties
importJobProperties) (\s :: DescribeFHIRImportJobResponse
s@DescribeFHIRImportJobResponse' {} ImportJobProperties
a -> DescribeFHIRImportJobResponse
s {$sel:importJobProperties:DescribeFHIRImportJobResponse' :: ImportJobProperties
importJobProperties = ImportJobProperties
a} :: DescribeFHIRImportJobResponse)

instance Prelude.NFData DescribeFHIRImportJobResponse