{-# 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.DescribeFHIRExportJob
-- 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 export job, including the ID, ARN,
-- name, and the status of the job.
module Amazonka.HealthLake.DescribeFHIRExportJob
  ( -- * Creating a Request
    DescribeFHIRExportJob (..),
    newDescribeFHIRExportJob,

    -- * Request Lenses
    describeFHIRExportJob_datastoreId,
    describeFHIRExportJob_jobId,

    -- * Destructuring the Response
    DescribeFHIRExportJobResponse (..),
    newDescribeFHIRExportJobResponse,

    -- * Response Lenses
    describeFHIRExportJobResponse_httpStatus,
    describeFHIRExportJobResponse_exportJobProperties,
  )
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:/ 'newDescribeFHIRExportJob' smart constructor.
data DescribeFHIRExportJob = DescribeFHIRExportJob'
  { -- | The AWS generated ID for the Data Store from which files are being
    -- exported from for an export job.
    DescribeFHIRExportJob -> Text
datastoreId :: Prelude.Text,
    -- | The AWS generated ID for an export job.
    DescribeFHIRExportJob -> Text
jobId :: Prelude.Text
  }
  deriving (DescribeFHIRExportJob -> DescribeFHIRExportJob -> Bool
(DescribeFHIRExportJob -> DescribeFHIRExportJob -> Bool)
-> (DescribeFHIRExportJob -> DescribeFHIRExportJob -> Bool)
-> Eq DescribeFHIRExportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFHIRExportJob -> DescribeFHIRExportJob -> Bool
$c/= :: DescribeFHIRExportJob -> DescribeFHIRExportJob -> Bool
== :: DescribeFHIRExportJob -> DescribeFHIRExportJob -> Bool
$c== :: DescribeFHIRExportJob -> DescribeFHIRExportJob -> Bool
Prelude.Eq, ReadPrec [DescribeFHIRExportJob]
ReadPrec DescribeFHIRExportJob
Int -> ReadS DescribeFHIRExportJob
ReadS [DescribeFHIRExportJob]
(Int -> ReadS DescribeFHIRExportJob)
-> ReadS [DescribeFHIRExportJob]
-> ReadPrec DescribeFHIRExportJob
-> ReadPrec [DescribeFHIRExportJob]
-> Read DescribeFHIRExportJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFHIRExportJob]
$creadListPrec :: ReadPrec [DescribeFHIRExportJob]
readPrec :: ReadPrec DescribeFHIRExportJob
$creadPrec :: ReadPrec DescribeFHIRExportJob
readList :: ReadS [DescribeFHIRExportJob]
$creadList :: ReadS [DescribeFHIRExportJob]
readsPrec :: Int -> ReadS DescribeFHIRExportJob
$creadsPrec :: Int -> ReadS DescribeFHIRExportJob
Prelude.Read, Int -> DescribeFHIRExportJob -> ShowS
[DescribeFHIRExportJob] -> ShowS
DescribeFHIRExportJob -> String
(Int -> DescribeFHIRExportJob -> ShowS)
-> (DescribeFHIRExportJob -> String)
-> ([DescribeFHIRExportJob] -> ShowS)
-> Show DescribeFHIRExportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFHIRExportJob] -> ShowS
$cshowList :: [DescribeFHIRExportJob] -> ShowS
show :: DescribeFHIRExportJob -> String
$cshow :: DescribeFHIRExportJob -> String
showsPrec :: Int -> DescribeFHIRExportJob -> ShowS
$cshowsPrec :: Int -> DescribeFHIRExportJob -> ShowS
Prelude.Show, (forall x. DescribeFHIRExportJob -> Rep DescribeFHIRExportJob x)
-> (forall x. Rep DescribeFHIRExportJob x -> DescribeFHIRExportJob)
-> Generic DescribeFHIRExportJob
forall x. Rep DescribeFHIRExportJob x -> DescribeFHIRExportJob
forall x. DescribeFHIRExportJob -> Rep DescribeFHIRExportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFHIRExportJob x -> DescribeFHIRExportJob
$cfrom :: forall x. DescribeFHIRExportJob -> Rep DescribeFHIRExportJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFHIRExportJob' 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', 'describeFHIRExportJob_datastoreId' - The AWS generated ID for the Data Store from which files are being
-- exported from for an export job.
--
-- 'jobId', 'describeFHIRExportJob_jobId' - The AWS generated ID for an export job.
newDescribeFHIRExportJob ::
  -- | 'datastoreId'
  Prelude.Text ->
  -- | 'jobId'
  Prelude.Text ->
  DescribeFHIRExportJob
newDescribeFHIRExportJob :: Text -> Text -> DescribeFHIRExportJob
newDescribeFHIRExportJob Text
pDatastoreId_ Text
pJobId_ =
  DescribeFHIRExportJob' :: Text -> Text -> DescribeFHIRExportJob
DescribeFHIRExportJob'
    { $sel:datastoreId:DescribeFHIRExportJob' :: Text
datastoreId = Text
pDatastoreId_,
      $sel:jobId:DescribeFHIRExportJob' :: Text
jobId = Text
pJobId_
    }

-- | The AWS generated ID for the Data Store from which files are being
-- exported from for an export job.
describeFHIRExportJob_datastoreId :: Lens.Lens' DescribeFHIRExportJob Prelude.Text
describeFHIRExportJob_datastoreId :: (Text -> f Text)
-> DescribeFHIRExportJob -> f DescribeFHIRExportJob
describeFHIRExportJob_datastoreId = (DescribeFHIRExportJob -> Text)
-> (DescribeFHIRExportJob -> Text -> DescribeFHIRExportJob)
-> Lens DescribeFHIRExportJob DescribeFHIRExportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFHIRExportJob' {Text
datastoreId :: Text
$sel:datastoreId:DescribeFHIRExportJob' :: DescribeFHIRExportJob -> Text
datastoreId} -> Text
datastoreId) (\s :: DescribeFHIRExportJob
s@DescribeFHIRExportJob' {} Text
a -> DescribeFHIRExportJob
s {$sel:datastoreId:DescribeFHIRExportJob' :: Text
datastoreId = Text
a} :: DescribeFHIRExportJob)

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

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

instance Prelude.Hashable DescribeFHIRExportJob

instance Prelude.NFData DescribeFHIRExportJob

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

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

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

-- |
-- Create a value of 'DescribeFHIRExportJobResponse' 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', 'describeFHIRExportJobResponse_httpStatus' - The response's http status code.
--
-- 'exportJobProperties', 'describeFHIRExportJobResponse_exportJobProperties' - Displays the properties of the export job, including the ID, Arn, Name,
-- and the status of the job.
newDescribeFHIRExportJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'exportJobProperties'
  ExportJobProperties ->
  DescribeFHIRExportJobResponse
newDescribeFHIRExportJobResponse :: Int -> ExportJobProperties -> DescribeFHIRExportJobResponse
newDescribeFHIRExportJobResponse
  Int
pHttpStatus_
  ExportJobProperties
pExportJobProperties_ =
    DescribeFHIRExportJobResponse' :: Int -> ExportJobProperties -> DescribeFHIRExportJobResponse
DescribeFHIRExportJobResponse'
      { $sel:httpStatus:DescribeFHIRExportJobResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:exportJobProperties:DescribeFHIRExportJobResponse' :: ExportJobProperties
exportJobProperties = ExportJobProperties
pExportJobProperties_
      }

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

-- | Displays the properties of the export job, including the ID, Arn, Name,
-- and the status of the job.
describeFHIRExportJobResponse_exportJobProperties :: Lens.Lens' DescribeFHIRExportJobResponse ExportJobProperties
describeFHIRExportJobResponse_exportJobProperties :: (ExportJobProperties -> f ExportJobProperties)
-> DescribeFHIRExportJobResponse -> f DescribeFHIRExportJobResponse
describeFHIRExportJobResponse_exportJobProperties = (DescribeFHIRExportJobResponse -> ExportJobProperties)
-> (DescribeFHIRExportJobResponse
    -> ExportJobProperties -> DescribeFHIRExportJobResponse)
-> Lens
     DescribeFHIRExportJobResponse
     DescribeFHIRExportJobResponse
     ExportJobProperties
     ExportJobProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFHIRExportJobResponse' {ExportJobProperties
exportJobProperties :: ExportJobProperties
$sel:exportJobProperties:DescribeFHIRExportJobResponse' :: DescribeFHIRExportJobResponse -> ExportJobProperties
exportJobProperties} -> ExportJobProperties
exportJobProperties) (\s :: DescribeFHIRExportJobResponse
s@DescribeFHIRExportJobResponse' {} ExportJobProperties
a -> DescribeFHIRExportJobResponse
s {$sel:exportJobProperties:DescribeFHIRExportJobResponse' :: ExportJobProperties
exportJobProperties = ExportJobProperties
a} :: DescribeFHIRExportJobResponse)

instance Prelude.NFData DescribeFHIRExportJobResponse