{-# 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.MGN.GetReplicationConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all ReplicationConfigurations, filtered by Source Server ID.
module Amazonka.MGN.GetReplicationConfiguration
  ( -- * Creating a Request
    GetReplicationConfiguration (..),
    newGetReplicationConfiguration,

    -- * Request Lenses
    getReplicationConfiguration_sourceServerID,

    -- * Destructuring the Response
    ReplicationConfiguration (..),
    newReplicationConfiguration,

    -- * Response Lenses
    replicationConfiguration_associateDefaultSecurityGroup,
    replicationConfiguration_bandwidthThrottling,
    replicationConfiguration_createPublicIP,
    replicationConfiguration_dataPlaneRouting,
    replicationConfiguration_defaultLargeStagingDiskType,
    replicationConfiguration_ebsEncryption,
    replicationConfiguration_ebsEncryptionKeyArn,
    replicationConfiguration_name,
    replicationConfiguration_replicatedDisks,
    replicationConfiguration_replicationServerInstanceType,
    replicationConfiguration_replicationServersSecurityGroupsIDs,
    replicationConfiguration_sourceServerID,
    replicationConfiguration_stagingAreaSubnetId,
    replicationConfiguration_stagingAreaTags,
    replicationConfiguration_useDedicatedReplicationServer,
  )
where

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

-- | /See:/ 'newGetReplicationConfiguration' smart constructor.
data GetReplicationConfiguration = GetReplicationConfiguration'
  { -- | Request to get Replication Configuration by Source Server ID.
    GetReplicationConfiguration -> Text
sourceServerID :: Prelude.Text
  }
  deriving (GetReplicationConfiguration -> GetReplicationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReplicationConfiguration -> GetReplicationConfiguration -> Bool
$c/= :: GetReplicationConfiguration -> GetReplicationConfiguration -> Bool
== :: GetReplicationConfiguration -> GetReplicationConfiguration -> Bool
$c== :: GetReplicationConfiguration -> GetReplicationConfiguration -> Bool
Prelude.Eq, ReadPrec [GetReplicationConfiguration]
ReadPrec GetReplicationConfiguration
Int -> ReadS GetReplicationConfiguration
ReadS [GetReplicationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReplicationConfiguration]
$creadListPrec :: ReadPrec [GetReplicationConfiguration]
readPrec :: ReadPrec GetReplicationConfiguration
$creadPrec :: ReadPrec GetReplicationConfiguration
readList :: ReadS [GetReplicationConfiguration]
$creadList :: ReadS [GetReplicationConfiguration]
readsPrec :: Int -> ReadS GetReplicationConfiguration
$creadsPrec :: Int -> ReadS GetReplicationConfiguration
Prelude.Read, Int -> GetReplicationConfiguration -> ShowS
[GetReplicationConfiguration] -> ShowS
GetReplicationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReplicationConfiguration] -> ShowS
$cshowList :: [GetReplicationConfiguration] -> ShowS
show :: GetReplicationConfiguration -> String
$cshow :: GetReplicationConfiguration -> String
showsPrec :: Int -> GetReplicationConfiguration -> ShowS
$cshowsPrec :: Int -> GetReplicationConfiguration -> ShowS
Prelude.Show, forall x.
Rep GetReplicationConfiguration x -> GetReplicationConfiguration
forall x.
GetReplicationConfiguration -> Rep GetReplicationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReplicationConfiguration x -> GetReplicationConfiguration
$cfrom :: forall x.
GetReplicationConfiguration -> Rep GetReplicationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'GetReplicationConfiguration' 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:
--
-- 'sourceServerID', 'getReplicationConfiguration_sourceServerID' - Request to get Replication Configuration by Source Server ID.
newGetReplicationConfiguration ::
  -- | 'sourceServerID'
  Prelude.Text ->
  GetReplicationConfiguration
newGetReplicationConfiguration :: Text -> GetReplicationConfiguration
newGetReplicationConfiguration Text
pSourceServerID_ =
  GetReplicationConfiguration'
    { $sel:sourceServerID:GetReplicationConfiguration' :: Text
sourceServerID =
        Text
pSourceServerID_
    }

-- | Request to get Replication Configuration by Source Server ID.
getReplicationConfiguration_sourceServerID :: Lens.Lens' GetReplicationConfiguration Prelude.Text
getReplicationConfiguration_sourceServerID :: Lens' GetReplicationConfiguration Text
getReplicationConfiguration_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReplicationConfiguration' {Text
sourceServerID :: Text
$sel:sourceServerID:GetReplicationConfiguration' :: GetReplicationConfiguration -> Text
sourceServerID} -> Text
sourceServerID) (\s :: GetReplicationConfiguration
s@GetReplicationConfiguration' {} Text
a -> GetReplicationConfiguration
s {$sel:sourceServerID:GetReplicationConfiguration' :: Text
sourceServerID = Text
a} :: GetReplicationConfiguration)

instance Core.AWSRequest GetReplicationConfiguration where
  type
    AWSResponse GetReplicationConfiguration =
      ReplicationConfiguration
  request :: (Service -> Service)
-> GetReplicationConfiguration
-> Request GetReplicationConfiguration
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 GetReplicationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetReplicationConfiguration)))
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 -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)

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

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

instance Data.ToHeaders GetReplicationConfiguration where
  toHeaders :: GetReplicationConfiguration -> 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.ToJSON GetReplicationConfiguration where
  toJSON :: GetReplicationConfiguration -> Value
toJSON GetReplicationConfiguration' {Text
sourceServerID :: Text
$sel:sourceServerID:GetReplicationConfiguration' :: GetReplicationConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"sourceServerID" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sourceServerID)
          ]
      )

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

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