{-# 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.DocDbElastic.GetClusterSnapshot
-- 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 specific Elastic DocumentDB snapshot
module Amazonka.DocDbElastic.GetClusterSnapshot
  ( -- * Creating a Request
    GetClusterSnapshot (..),
    newGetClusterSnapshot,

    -- * Request Lenses
    getClusterSnapshot_snapshotArn,

    -- * Destructuring the Response
    GetClusterSnapshotResponse (..),
    newGetClusterSnapshotResponse,

    -- * Response Lenses
    getClusterSnapshotResponse_httpStatus,
    getClusterSnapshotResponse_snapshot,
  )
where

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

-- | /See:/ 'newGetClusterSnapshot' smart constructor.
data GetClusterSnapshot = GetClusterSnapshot'
  { -- | The arn of the Elastic DocumentDB snapshot.
    GetClusterSnapshot -> Text
snapshotArn :: Prelude.Text
  }
  deriving (GetClusterSnapshot -> GetClusterSnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetClusterSnapshot -> GetClusterSnapshot -> Bool
$c/= :: GetClusterSnapshot -> GetClusterSnapshot -> Bool
== :: GetClusterSnapshot -> GetClusterSnapshot -> Bool
$c== :: GetClusterSnapshot -> GetClusterSnapshot -> Bool
Prelude.Eq, ReadPrec [GetClusterSnapshot]
ReadPrec GetClusterSnapshot
Int -> ReadS GetClusterSnapshot
ReadS [GetClusterSnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetClusterSnapshot]
$creadListPrec :: ReadPrec [GetClusterSnapshot]
readPrec :: ReadPrec GetClusterSnapshot
$creadPrec :: ReadPrec GetClusterSnapshot
readList :: ReadS [GetClusterSnapshot]
$creadList :: ReadS [GetClusterSnapshot]
readsPrec :: Int -> ReadS GetClusterSnapshot
$creadsPrec :: Int -> ReadS GetClusterSnapshot
Prelude.Read, Int -> GetClusterSnapshot -> ShowS
[GetClusterSnapshot] -> ShowS
GetClusterSnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetClusterSnapshot] -> ShowS
$cshowList :: [GetClusterSnapshot] -> ShowS
show :: GetClusterSnapshot -> String
$cshow :: GetClusterSnapshot -> String
showsPrec :: Int -> GetClusterSnapshot -> ShowS
$cshowsPrec :: Int -> GetClusterSnapshot -> ShowS
Prelude.Show, forall x. Rep GetClusterSnapshot x -> GetClusterSnapshot
forall x. GetClusterSnapshot -> Rep GetClusterSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetClusterSnapshot x -> GetClusterSnapshot
$cfrom :: forall x. GetClusterSnapshot -> Rep GetClusterSnapshot x
Prelude.Generic)

-- |
-- Create a value of 'GetClusterSnapshot' 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:
--
-- 'snapshotArn', 'getClusterSnapshot_snapshotArn' - The arn of the Elastic DocumentDB snapshot.
newGetClusterSnapshot ::
  -- | 'snapshotArn'
  Prelude.Text ->
  GetClusterSnapshot
newGetClusterSnapshot :: Text -> GetClusterSnapshot
newGetClusterSnapshot Text
pSnapshotArn_ =
  GetClusterSnapshot' {$sel:snapshotArn:GetClusterSnapshot' :: Text
snapshotArn = Text
pSnapshotArn_}

-- | The arn of the Elastic DocumentDB snapshot.
getClusterSnapshot_snapshotArn :: Lens.Lens' GetClusterSnapshot Prelude.Text
getClusterSnapshot_snapshotArn :: Lens' GetClusterSnapshot Text
getClusterSnapshot_snapshotArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClusterSnapshot' {Text
snapshotArn :: Text
$sel:snapshotArn:GetClusterSnapshot' :: GetClusterSnapshot -> Text
snapshotArn} -> Text
snapshotArn) (\s :: GetClusterSnapshot
s@GetClusterSnapshot' {} Text
a -> GetClusterSnapshot
s {$sel:snapshotArn:GetClusterSnapshot' :: Text
snapshotArn = Text
a} :: GetClusterSnapshot)

instance Core.AWSRequest GetClusterSnapshot where
  type
    AWSResponse GetClusterSnapshot =
      GetClusterSnapshotResponse
  request :: (Service -> Service)
-> GetClusterSnapshot -> Request GetClusterSnapshot
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetClusterSnapshot)))
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 ->
          Int -> ClusterSnapshot -> GetClusterSnapshotResponse
GetClusterSnapshotResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"snapshot")
      )

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

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

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

instance Data.ToPath GetClusterSnapshot where
  toPath :: GetClusterSnapshot -> ByteString
toPath GetClusterSnapshot' {Text
snapshotArn :: Text
$sel:snapshotArn:GetClusterSnapshot' :: GetClusterSnapshot -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/cluster-snapshot/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
snapshotArn]

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

-- | /See:/ 'newGetClusterSnapshotResponse' smart constructor.
data GetClusterSnapshotResponse = GetClusterSnapshotResponse'
  { -- | The response's http status code.
    GetClusterSnapshotResponse -> Int
httpStatus :: Prelude.Int,
    -- | Returns information about a specific Elastic DocumentDB snapshot.
    GetClusterSnapshotResponse -> ClusterSnapshot
snapshot :: ClusterSnapshot
  }
  deriving (GetClusterSnapshotResponse -> GetClusterSnapshotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetClusterSnapshotResponse -> GetClusterSnapshotResponse -> Bool
$c/= :: GetClusterSnapshotResponse -> GetClusterSnapshotResponse -> Bool
== :: GetClusterSnapshotResponse -> GetClusterSnapshotResponse -> Bool
$c== :: GetClusterSnapshotResponse -> GetClusterSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [GetClusterSnapshotResponse]
ReadPrec GetClusterSnapshotResponse
Int -> ReadS GetClusterSnapshotResponse
ReadS [GetClusterSnapshotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetClusterSnapshotResponse]
$creadListPrec :: ReadPrec [GetClusterSnapshotResponse]
readPrec :: ReadPrec GetClusterSnapshotResponse
$creadPrec :: ReadPrec GetClusterSnapshotResponse
readList :: ReadS [GetClusterSnapshotResponse]
$creadList :: ReadS [GetClusterSnapshotResponse]
readsPrec :: Int -> ReadS GetClusterSnapshotResponse
$creadsPrec :: Int -> ReadS GetClusterSnapshotResponse
Prelude.Read, Int -> GetClusterSnapshotResponse -> ShowS
[GetClusterSnapshotResponse] -> ShowS
GetClusterSnapshotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetClusterSnapshotResponse] -> ShowS
$cshowList :: [GetClusterSnapshotResponse] -> ShowS
show :: GetClusterSnapshotResponse -> String
$cshow :: GetClusterSnapshotResponse -> String
showsPrec :: Int -> GetClusterSnapshotResponse -> ShowS
$cshowsPrec :: Int -> GetClusterSnapshotResponse -> ShowS
Prelude.Show, forall x.
Rep GetClusterSnapshotResponse x -> GetClusterSnapshotResponse
forall x.
GetClusterSnapshotResponse -> Rep GetClusterSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetClusterSnapshotResponse x -> GetClusterSnapshotResponse
$cfrom :: forall x.
GetClusterSnapshotResponse -> Rep GetClusterSnapshotResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetClusterSnapshotResponse' 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', 'getClusterSnapshotResponse_httpStatus' - The response's http status code.
--
-- 'snapshot', 'getClusterSnapshotResponse_snapshot' - Returns information about a specific Elastic DocumentDB snapshot.
newGetClusterSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'snapshot'
  ClusterSnapshot ->
  GetClusterSnapshotResponse
newGetClusterSnapshotResponse :: Int -> ClusterSnapshot -> GetClusterSnapshotResponse
newGetClusterSnapshotResponse Int
pHttpStatus_ ClusterSnapshot
pSnapshot_ =
  GetClusterSnapshotResponse'
    { $sel:httpStatus:GetClusterSnapshotResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:snapshot:GetClusterSnapshotResponse' :: ClusterSnapshot
snapshot = ClusterSnapshot
pSnapshot_
    }

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

-- | Returns information about a specific Elastic DocumentDB snapshot.
getClusterSnapshotResponse_snapshot :: Lens.Lens' GetClusterSnapshotResponse ClusterSnapshot
getClusterSnapshotResponse_snapshot :: Lens' GetClusterSnapshotResponse ClusterSnapshot
getClusterSnapshotResponse_snapshot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetClusterSnapshotResponse' {ClusterSnapshot
snapshot :: ClusterSnapshot
$sel:snapshot:GetClusterSnapshotResponse' :: GetClusterSnapshotResponse -> ClusterSnapshot
snapshot} -> ClusterSnapshot
snapshot) (\s :: GetClusterSnapshotResponse
s@GetClusterSnapshotResponse' {} ClusterSnapshot
a -> GetClusterSnapshotResponse
s {$sel:snapshot:GetClusterSnapshotResponse' :: ClusterSnapshot
snapshot = ClusterSnapshot
a} :: GetClusterSnapshotResponse)

instance Prelude.NFData GetClusterSnapshotResponse where
  rnf :: GetClusterSnapshotResponse -> ()
rnf GetClusterSnapshotResponse' {Int
ClusterSnapshot
snapshot :: ClusterSnapshot
httpStatus :: Int
$sel:snapshot:GetClusterSnapshotResponse' :: GetClusterSnapshotResponse -> ClusterSnapshot
$sel:httpStatus:GetClusterSnapshotResponse' :: GetClusterSnapshotResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ClusterSnapshot
snapshot