{-# 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.RedshiftServerLess.GetRecoveryPoint
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information about a recovery point.
module Amazonka.RedshiftServerLess.GetRecoveryPoint
  ( -- * Creating a Request
    GetRecoveryPoint (..),
    newGetRecoveryPoint,

    -- * Request Lenses
    getRecoveryPoint_recoveryPointId,

    -- * Destructuring the Response
    GetRecoveryPointResponse (..),
    newGetRecoveryPointResponse,

    -- * Response Lenses
    getRecoveryPointResponse_recoveryPoint,
    getRecoveryPointResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.RedshiftServerLess.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetRecoveryPoint' smart constructor.
data GetRecoveryPoint = GetRecoveryPoint'
  { -- | The unique identifier of the recovery point to return information for.
    GetRecoveryPoint -> Text
recoveryPointId :: Prelude.Text
  }
  deriving (GetRecoveryPoint -> GetRecoveryPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecoveryPoint -> GetRecoveryPoint -> Bool
$c/= :: GetRecoveryPoint -> GetRecoveryPoint -> Bool
== :: GetRecoveryPoint -> GetRecoveryPoint -> Bool
$c== :: GetRecoveryPoint -> GetRecoveryPoint -> Bool
Prelude.Eq, ReadPrec [GetRecoveryPoint]
ReadPrec GetRecoveryPoint
Int -> ReadS GetRecoveryPoint
ReadS [GetRecoveryPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecoveryPoint]
$creadListPrec :: ReadPrec [GetRecoveryPoint]
readPrec :: ReadPrec GetRecoveryPoint
$creadPrec :: ReadPrec GetRecoveryPoint
readList :: ReadS [GetRecoveryPoint]
$creadList :: ReadS [GetRecoveryPoint]
readsPrec :: Int -> ReadS GetRecoveryPoint
$creadsPrec :: Int -> ReadS GetRecoveryPoint
Prelude.Read, Int -> GetRecoveryPoint -> ShowS
[GetRecoveryPoint] -> ShowS
GetRecoveryPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecoveryPoint] -> ShowS
$cshowList :: [GetRecoveryPoint] -> ShowS
show :: GetRecoveryPoint -> String
$cshow :: GetRecoveryPoint -> String
showsPrec :: Int -> GetRecoveryPoint -> ShowS
$cshowsPrec :: Int -> GetRecoveryPoint -> ShowS
Prelude.Show, forall x. Rep GetRecoveryPoint x -> GetRecoveryPoint
forall x. GetRecoveryPoint -> Rep GetRecoveryPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRecoveryPoint x -> GetRecoveryPoint
$cfrom :: forall x. GetRecoveryPoint -> Rep GetRecoveryPoint x
Prelude.Generic)

-- |
-- Create a value of 'GetRecoveryPoint' 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:
--
-- 'recoveryPointId', 'getRecoveryPoint_recoveryPointId' - The unique identifier of the recovery point to return information for.
newGetRecoveryPoint ::
  -- | 'recoveryPointId'
  Prelude.Text ->
  GetRecoveryPoint
newGetRecoveryPoint :: Text -> GetRecoveryPoint
newGetRecoveryPoint Text
pRecoveryPointId_ =
  GetRecoveryPoint'
    { $sel:recoveryPointId:GetRecoveryPoint' :: Text
recoveryPointId =
        Text
pRecoveryPointId_
    }

-- | The unique identifier of the recovery point to return information for.
getRecoveryPoint_recoveryPointId :: Lens.Lens' GetRecoveryPoint Prelude.Text
getRecoveryPoint_recoveryPointId :: Lens' GetRecoveryPoint Text
getRecoveryPoint_recoveryPointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecoveryPoint' {Text
recoveryPointId :: Text
$sel:recoveryPointId:GetRecoveryPoint' :: GetRecoveryPoint -> Text
recoveryPointId} -> Text
recoveryPointId) (\s :: GetRecoveryPoint
s@GetRecoveryPoint' {} Text
a -> GetRecoveryPoint
s {$sel:recoveryPointId:GetRecoveryPoint' :: Text
recoveryPointId = Text
a} :: GetRecoveryPoint)

instance Core.AWSRequest GetRecoveryPoint where
  type
    AWSResponse GetRecoveryPoint =
      GetRecoveryPointResponse
  request :: (Service -> Service)
-> GetRecoveryPoint -> Request GetRecoveryPoint
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetRecoveryPoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRecoveryPoint)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe RecoveryPoint -> Int -> GetRecoveryPointResponse
GetRecoveryPointResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"recoveryPoint")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetRecoveryPoint where
  hashWithSalt :: Int -> GetRecoveryPoint -> Int
hashWithSalt Int
_salt GetRecoveryPoint' {Text
recoveryPointId :: Text
$sel:recoveryPointId:GetRecoveryPoint' :: GetRecoveryPoint -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
recoveryPointId

instance Prelude.NFData GetRecoveryPoint where
  rnf :: GetRecoveryPoint -> ()
rnf GetRecoveryPoint' {Text
recoveryPointId :: Text
$sel:recoveryPointId:GetRecoveryPoint' :: GetRecoveryPoint -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
recoveryPointId

instance Data.ToHeaders GetRecoveryPoint where
  toHeaders :: GetRecoveryPoint -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"RedshiftServerless.GetRecoveryPoint" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetRecoveryPoint where
  toJSON :: GetRecoveryPoint -> Value
toJSON GetRecoveryPoint' {Text
recoveryPointId :: Text
$sel:recoveryPointId:GetRecoveryPoint' :: GetRecoveryPoint -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"recoveryPointId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
recoveryPointId)
          ]
      )

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

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

-- | /See:/ 'newGetRecoveryPointResponse' smart constructor.
data GetRecoveryPointResponse = GetRecoveryPointResponse'
  { -- | The returned recovery point object.
    GetRecoveryPointResponse -> Maybe RecoveryPoint
recoveryPoint :: Prelude.Maybe RecoveryPoint,
    -- | The response's http status code.
    GetRecoveryPointResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetRecoveryPointResponse -> GetRecoveryPointResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecoveryPointResponse -> GetRecoveryPointResponse -> Bool
$c/= :: GetRecoveryPointResponse -> GetRecoveryPointResponse -> Bool
== :: GetRecoveryPointResponse -> GetRecoveryPointResponse -> Bool
$c== :: GetRecoveryPointResponse -> GetRecoveryPointResponse -> Bool
Prelude.Eq, ReadPrec [GetRecoveryPointResponse]
ReadPrec GetRecoveryPointResponse
Int -> ReadS GetRecoveryPointResponse
ReadS [GetRecoveryPointResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecoveryPointResponse]
$creadListPrec :: ReadPrec [GetRecoveryPointResponse]
readPrec :: ReadPrec GetRecoveryPointResponse
$creadPrec :: ReadPrec GetRecoveryPointResponse
readList :: ReadS [GetRecoveryPointResponse]
$creadList :: ReadS [GetRecoveryPointResponse]
readsPrec :: Int -> ReadS GetRecoveryPointResponse
$creadsPrec :: Int -> ReadS GetRecoveryPointResponse
Prelude.Read, Int -> GetRecoveryPointResponse -> ShowS
[GetRecoveryPointResponse] -> ShowS
GetRecoveryPointResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecoveryPointResponse] -> ShowS
$cshowList :: [GetRecoveryPointResponse] -> ShowS
show :: GetRecoveryPointResponse -> String
$cshow :: GetRecoveryPointResponse -> String
showsPrec :: Int -> GetRecoveryPointResponse -> ShowS
$cshowsPrec :: Int -> GetRecoveryPointResponse -> ShowS
Prelude.Show, forall x.
Rep GetRecoveryPointResponse x -> GetRecoveryPointResponse
forall x.
GetRecoveryPointResponse -> Rep GetRecoveryPointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRecoveryPointResponse x -> GetRecoveryPointResponse
$cfrom :: forall x.
GetRecoveryPointResponse -> Rep GetRecoveryPointResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetRecoveryPointResponse' 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:
--
-- 'recoveryPoint', 'getRecoveryPointResponse_recoveryPoint' - The returned recovery point object.
--
-- 'httpStatus', 'getRecoveryPointResponse_httpStatus' - The response's http status code.
newGetRecoveryPointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetRecoveryPointResponse
newGetRecoveryPointResponse :: Int -> GetRecoveryPointResponse
newGetRecoveryPointResponse Int
pHttpStatus_ =
  GetRecoveryPointResponse'
    { $sel:recoveryPoint:GetRecoveryPointResponse' :: Maybe RecoveryPoint
recoveryPoint =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetRecoveryPointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The returned recovery point object.
getRecoveryPointResponse_recoveryPoint :: Lens.Lens' GetRecoveryPointResponse (Prelude.Maybe RecoveryPoint)
getRecoveryPointResponse_recoveryPoint :: Lens' GetRecoveryPointResponse (Maybe RecoveryPoint)
getRecoveryPointResponse_recoveryPoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecoveryPointResponse' {Maybe RecoveryPoint
recoveryPoint :: Maybe RecoveryPoint
$sel:recoveryPoint:GetRecoveryPointResponse' :: GetRecoveryPointResponse -> Maybe RecoveryPoint
recoveryPoint} -> Maybe RecoveryPoint
recoveryPoint) (\s :: GetRecoveryPointResponse
s@GetRecoveryPointResponse' {} Maybe RecoveryPoint
a -> GetRecoveryPointResponse
s {$sel:recoveryPoint:GetRecoveryPointResponse' :: Maybe RecoveryPoint
recoveryPoint = Maybe RecoveryPoint
a} :: GetRecoveryPointResponse)

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

instance Prelude.NFData GetRecoveryPointResponse where
  rnf :: GetRecoveryPointResponse -> ()
rnf GetRecoveryPointResponse' {Int
Maybe RecoveryPoint
httpStatus :: Int
recoveryPoint :: Maybe RecoveryPoint
$sel:httpStatus:GetRecoveryPointResponse' :: GetRecoveryPointResponse -> Int
$sel:recoveryPoint:GetRecoveryPointResponse' :: GetRecoveryPointResponse -> Maybe RecoveryPoint
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe RecoveryPoint
recoveryPoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus