{-# 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.DescribeFHIRDatastore
-- 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 the FHIR Data Store, including the
-- Data Store ID, Data Store ARN, Data Store name, Data Store status,
-- created at, Data Store type version, and Data Store endpoint.
module Amazonka.HealthLake.DescribeFHIRDatastore
  ( -- * Creating a Request
    DescribeFHIRDatastore (..),
    newDescribeFHIRDatastore,

    -- * Request Lenses
    describeFHIRDatastore_datastoreId,

    -- * Destructuring the Response
    DescribeFHIRDatastoreResponse (..),
    newDescribeFHIRDatastoreResponse,

    -- * Response Lenses
    describeFHIRDatastoreResponse_httpStatus,
    describeFHIRDatastoreResponse_datastoreProperties,
  )
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:/ 'newDescribeFHIRDatastore' smart constructor.
data DescribeFHIRDatastore = DescribeFHIRDatastore'
  { -- | The AWS-generated Data Store id. This is part of the
    -- ‘CreateFHIRDatastore’ output.
    DescribeFHIRDatastore -> Maybe Text
datastoreId :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeFHIRDatastore -> DescribeFHIRDatastore -> Bool
(DescribeFHIRDatastore -> DescribeFHIRDatastore -> Bool)
-> (DescribeFHIRDatastore -> DescribeFHIRDatastore -> Bool)
-> Eq DescribeFHIRDatastore
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFHIRDatastore -> DescribeFHIRDatastore -> Bool
$c/= :: DescribeFHIRDatastore -> DescribeFHIRDatastore -> Bool
== :: DescribeFHIRDatastore -> DescribeFHIRDatastore -> Bool
$c== :: DescribeFHIRDatastore -> DescribeFHIRDatastore -> Bool
Prelude.Eq, ReadPrec [DescribeFHIRDatastore]
ReadPrec DescribeFHIRDatastore
Int -> ReadS DescribeFHIRDatastore
ReadS [DescribeFHIRDatastore]
(Int -> ReadS DescribeFHIRDatastore)
-> ReadS [DescribeFHIRDatastore]
-> ReadPrec DescribeFHIRDatastore
-> ReadPrec [DescribeFHIRDatastore]
-> Read DescribeFHIRDatastore
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFHIRDatastore]
$creadListPrec :: ReadPrec [DescribeFHIRDatastore]
readPrec :: ReadPrec DescribeFHIRDatastore
$creadPrec :: ReadPrec DescribeFHIRDatastore
readList :: ReadS [DescribeFHIRDatastore]
$creadList :: ReadS [DescribeFHIRDatastore]
readsPrec :: Int -> ReadS DescribeFHIRDatastore
$creadsPrec :: Int -> ReadS DescribeFHIRDatastore
Prelude.Read, Int -> DescribeFHIRDatastore -> ShowS
[DescribeFHIRDatastore] -> ShowS
DescribeFHIRDatastore -> String
(Int -> DescribeFHIRDatastore -> ShowS)
-> (DescribeFHIRDatastore -> String)
-> ([DescribeFHIRDatastore] -> ShowS)
-> Show DescribeFHIRDatastore
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFHIRDatastore] -> ShowS
$cshowList :: [DescribeFHIRDatastore] -> ShowS
show :: DescribeFHIRDatastore -> String
$cshow :: DescribeFHIRDatastore -> String
showsPrec :: Int -> DescribeFHIRDatastore -> ShowS
$cshowsPrec :: Int -> DescribeFHIRDatastore -> ShowS
Prelude.Show, (forall x. DescribeFHIRDatastore -> Rep DescribeFHIRDatastore x)
-> (forall x. Rep DescribeFHIRDatastore x -> DescribeFHIRDatastore)
-> Generic DescribeFHIRDatastore
forall x. Rep DescribeFHIRDatastore x -> DescribeFHIRDatastore
forall x. DescribeFHIRDatastore -> Rep DescribeFHIRDatastore x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFHIRDatastore x -> DescribeFHIRDatastore
$cfrom :: forall x. DescribeFHIRDatastore -> Rep DescribeFHIRDatastore x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFHIRDatastore' 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', 'describeFHIRDatastore_datastoreId' - The AWS-generated Data Store id. This is part of the
-- ‘CreateFHIRDatastore’ output.
newDescribeFHIRDatastore ::
  DescribeFHIRDatastore
newDescribeFHIRDatastore :: DescribeFHIRDatastore
newDescribeFHIRDatastore =
  DescribeFHIRDatastore' :: Maybe Text -> DescribeFHIRDatastore
DescribeFHIRDatastore'
    { $sel:datastoreId:DescribeFHIRDatastore' :: Maybe Text
datastoreId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The AWS-generated Data Store id. This is part of the
-- ‘CreateFHIRDatastore’ output.
describeFHIRDatastore_datastoreId :: Lens.Lens' DescribeFHIRDatastore (Prelude.Maybe Prelude.Text)
describeFHIRDatastore_datastoreId :: (Maybe Text -> f (Maybe Text))
-> DescribeFHIRDatastore -> f DescribeFHIRDatastore
describeFHIRDatastore_datastoreId = (DescribeFHIRDatastore -> Maybe Text)
-> (DescribeFHIRDatastore -> Maybe Text -> DescribeFHIRDatastore)
-> Lens
     DescribeFHIRDatastore
     DescribeFHIRDatastore
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFHIRDatastore' {Maybe Text
datastoreId :: Maybe Text
$sel:datastoreId:DescribeFHIRDatastore' :: DescribeFHIRDatastore -> Maybe Text
datastoreId} -> Maybe Text
datastoreId) (\s :: DescribeFHIRDatastore
s@DescribeFHIRDatastore' {} Maybe Text
a -> DescribeFHIRDatastore
s {$sel:datastoreId:DescribeFHIRDatastore' :: Maybe Text
datastoreId = Maybe Text
a} :: DescribeFHIRDatastore)

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

instance Prelude.Hashable DescribeFHIRDatastore

instance Prelude.NFData DescribeFHIRDatastore

instance Core.ToHeaders DescribeFHIRDatastore where
  toHeaders :: DescribeFHIRDatastore -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeFHIRDatastore -> 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.DescribeFHIRDatastore" ::
                          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 DescribeFHIRDatastore where
  toJSON :: DescribeFHIRDatastore -> Value
toJSON DescribeFHIRDatastore' {Maybe Text
datastoreId :: Maybe Text
$sel:datastoreId:DescribeFHIRDatastore' :: DescribeFHIRDatastore -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"DatastoreId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
datastoreId]
      )

instance Core.ToPath DescribeFHIRDatastore where
  toPath :: DescribeFHIRDatastore -> ByteString
toPath = ByteString -> DescribeFHIRDatastore -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDescribeFHIRDatastoreResponse' smart constructor.
data DescribeFHIRDatastoreResponse = DescribeFHIRDatastoreResponse'
  { -- | The response's http status code.
    DescribeFHIRDatastoreResponse -> Int
httpStatus :: Prelude.Int,
    -- | All properties associated with a Data Store, including the Data Store
    -- ID, Data Store ARN, Data Store name, Data Store status, created at, Data
    -- Store type version, and Data Store endpoint.
    DescribeFHIRDatastoreResponse -> DatastoreProperties
datastoreProperties :: DatastoreProperties
  }
  deriving (DescribeFHIRDatastoreResponse
-> DescribeFHIRDatastoreResponse -> Bool
(DescribeFHIRDatastoreResponse
 -> DescribeFHIRDatastoreResponse -> Bool)
-> (DescribeFHIRDatastoreResponse
    -> DescribeFHIRDatastoreResponse -> Bool)
-> Eq DescribeFHIRDatastoreResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFHIRDatastoreResponse
-> DescribeFHIRDatastoreResponse -> Bool
$c/= :: DescribeFHIRDatastoreResponse
-> DescribeFHIRDatastoreResponse -> Bool
== :: DescribeFHIRDatastoreResponse
-> DescribeFHIRDatastoreResponse -> Bool
$c== :: DescribeFHIRDatastoreResponse
-> DescribeFHIRDatastoreResponse -> Bool
Prelude.Eq, ReadPrec [DescribeFHIRDatastoreResponse]
ReadPrec DescribeFHIRDatastoreResponse
Int -> ReadS DescribeFHIRDatastoreResponse
ReadS [DescribeFHIRDatastoreResponse]
(Int -> ReadS DescribeFHIRDatastoreResponse)
-> ReadS [DescribeFHIRDatastoreResponse]
-> ReadPrec DescribeFHIRDatastoreResponse
-> ReadPrec [DescribeFHIRDatastoreResponse]
-> Read DescribeFHIRDatastoreResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFHIRDatastoreResponse]
$creadListPrec :: ReadPrec [DescribeFHIRDatastoreResponse]
readPrec :: ReadPrec DescribeFHIRDatastoreResponse
$creadPrec :: ReadPrec DescribeFHIRDatastoreResponse
readList :: ReadS [DescribeFHIRDatastoreResponse]
$creadList :: ReadS [DescribeFHIRDatastoreResponse]
readsPrec :: Int -> ReadS DescribeFHIRDatastoreResponse
$creadsPrec :: Int -> ReadS DescribeFHIRDatastoreResponse
Prelude.Read, Int -> DescribeFHIRDatastoreResponse -> ShowS
[DescribeFHIRDatastoreResponse] -> ShowS
DescribeFHIRDatastoreResponse -> String
(Int -> DescribeFHIRDatastoreResponse -> ShowS)
-> (DescribeFHIRDatastoreResponse -> String)
-> ([DescribeFHIRDatastoreResponse] -> ShowS)
-> Show DescribeFHIRDatastoreResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFHIRDatastoreResponse] -> ShowS
$cshowList :: [DescribeFHIRDatastoreResponse] -> ShowS
show :: DescribeFHIRDatastoreResponse -> String
$cshow :: DescribeFHIRDatastoreResponse -> String
showsPrec :: Int -> DescribeFHIRDatastoreResponse -> ShowS
$cshowsPrec :: Int -> DescribeFHIRDatastoreResponse -> ShowS
Prelude.Show, (forall x.
 DescribeFHIRDatastoreResponse
 -> Rep DescribeFHIRDatastoreResponse x)
-> (forall x.
    Rep DescribeFHIRDatastoreResponse x
    -> DescribeFHIRDatastoreResponse)
-> Generic DescribeFHIRDatastoreResponse
forall x.
Rep DescribeFHIRDatastoreResponse x
-> DescribeFHIRDatastoreResponse
forall x.
DescribeFHIRDatastoreResponse
-> Rep DescribeFHIRDatastoreResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeFHIRDatastoreResponse x
-> DescribeFHIRDatastoreResponse
$cfrom :: forall x.
DescribeFHIRDatastoreResponse
-> Rep DescribeFHIRDatastoreResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFHIRDatastoreResponse' 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', 'describeFHIRDatastoreResponse_httpStatus' - The response's http status code.
--
-- 'datastoreProperties', 'describeFHIRDatastoreResponse_datastoreProperties' - All properties associated with a Data Store, including the Data Store
-- ID, Data Store ARN, Data Store name, Data Store status, created at, Data
-- Store type version, and Data Store endpoint.
newDescribeFHIRDatastoreResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'datastoreProperties'
  DatastoreProperties ->
  DescribeFHIRDatastoreResponse
newDescribeFHIRDatastoreResponse :: Int -> DatastoreProperties -> DescribeFHIRDatastoreResponse
newDescribeFHIRDatastoreResponse
  Int
pHttpStatus_
  DatastoreProperties
pDatastoreProperties_ =
    DescribeFHIRDatastoreResponse' :: Int -> DatastoreProperties -> DescribeFHIRDatastoreResponse
DescribeFHIRDatastoreResponse'
      { $sel:httpStatus:DescribeFHIRDatastoreResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:datastoreProperties:DescribeFHIRDatastoreResponse' :: DatastoreProperties
datastoreProperties = DatastoreProperties
pDatastoreProperties_
      }

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

-- | All properties associated with a Data Store, including the Data Store
-- ID, Data Store ARN, Data Store name, Data Store status, created at, Data
-- Store type version, and Data Store endpoint.
describeFHIRDatastoreResponse_datastoreProperties :: Lens.Lens' DescribeFHIRDatastoreResponse DatastoreProperties
describeFHIRDatastoreResponse_datastoreProperties :: (DatastoreProperties -> f DatastoreProperties)
-> DescribeFHIRDatastoreResponse -> f DescribeFHIRDatastoreResponse
describeFHIRDatastoreResponse_datastoreProperties = (DescribeFHIRDatastoreResponse -> DatastoreProperties)
-> (DescribeFHIRDatastoreResponse
    -> DatastoreProperties -> DescribeFHIRDatastoreResponse)
-> Lens
     DescribeFHIRDatastoreResponse
     DescribeFHIRDatastoreResponse
     DatastoreProperties
     DatastoreProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFHIRDatastoreResponse' {DatastoreProperties
datastoreProperties :: DatastoreProperties
$sel:datastoreProperties:DescribeFHIRDatastoreResponse' :: DescribeFHIRDatastoreResponse -> DatastoreProperties
datastoreProperties} -> DatastoreProperties
datastoreProperties) (\s :: DescribeFHIRDatastoreResponse
s@DescribeFHIRDatastoreResponse' {} DatastoreProperties
a -> DescribeFHIRDatastoreResponse
s {$sel:datastoreProperties:DescribeFHIRDatastoreResponse' :: DatastoreProperties
datastoreProperties = DatastoreProperties
a} :: DescribeFHIRDatastoreResponse)

instance Prelude.NFData DescribeFHIRDatastoreResponse