{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DrS.Types.StartRecoveryRequestSourceServer
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DrS.Types.StartRecoveryRequestSourceServer 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

-- | An object representing the Source Server to recover.
--
-- /See:/ 'newStartRecoveryRequestSourceServer' smart constructor.
data StartRecoveryRequestSourceServer = StartRecoveryRequestSourceServer'
  { -- | The ID of a Recovery Snapshot we want to recover from. Omit this field
    -- to launch from the latest data by taking an on-demand snapshot.
    StartRecoveryRequestSourceServer -> Maybe Text
recoverySnapshotID :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Source Server you want to recover.
    StartRecoveryRequestSourceServer -> Text
sourceServerID :: Prelude.Text
  }
  deriving (StartRecoveryRequestSourceServer
-> StartRecoveryRequestSourceServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartRecoveryRequestSourceServer
-> StartRecoveryRequestSourceServer -> Bool
$c/= :: StartRecoveryRequestSourceServer
-> StartRecoveryRequestSourceServer -> Bool
== :: StartRecoveryRequestSourceServer
-> StartRecoveryRequestSourceServer -> Bool
$c== :: StartRecoveryRequestSourceServer
-> StartRecoveryRequestSourceServer -> Bool
Prelude.Eq, ReadPrec [StartRecoveryRequestSourceServer]
ReadPrec StartRecoveryRequestSourceServer
Int -> ReadS StartRecoveryRequestSourceServer
ReadS [StartRecoveryRequestSourceServer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartRecoveryRequestSourceServer]
$creadListPrec :: ReadPrec [StartRecoveryRequestSourceServer]
readPrec :: ReadPrec StartRecoveryRequestSourceServer
$creadPrec :: ReadPrec StartRecoveryRequestSourceServer
readList :: ReadS [StartRecoveryRequestSourceServer]
$creadList :: ReadS [StartRecoveryRequestSourceServer]
readsPrec :: Int -> ReadS StartRecoveryRequestSourceServer
$creadsPrec :: Int -> ReadS StartRecoveryRequestSourceServer
Prelude.Read, Int -> StartRecoveryRequestSourceServer -> ShowS
[StartRecoveryRequestSourceServer] -> ShowS
StartRecoveryRequestSourceServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartRecoveryRequestSourceServer] -> ShowS
$cshowList :: [StartRecoveryRequestSourceServer] -> ShowS
show :: StartRecoveryRequestSourceServer -> String
$cshow :: StartRecoveryRequestSourceServer -> String
showsPrec :: Int -> StartRecoveryRequestSourceServer -> ShowS
$cshowsPrec :: Int -> StartRecoveryRequestSourceServer -> ShowS
Prelude.Show, forall x.
Rep StartRecoveryRequestSourceServer x
-> StartRecoveryRequestSourceServer
forall x.
StartRecoveryRequestSourceServer
-> Rep StartRecoveryRequestSourceServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartRecoveryRequestSourceServer x
-> StartRecoveryRequestSourceServer
$cfrom :: forall x.
StartRecoveryRequestSourceServer
-> Rep StartRecoveryRequestSourceServer x
Prelude.Generic)

-- |
-- Create a value of 'StartRecoveryRequestSourceServer' 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:
--
-- 'recoverySnapshotID', 'startRecoveryRequestSourceServer_recoverySnapshotID' - The ID of a Recovery Snapshot we want to recover from. Omit this field
-- to launch from the latest data by taking an on-demand snapshot.
--
-- 'sourceServerID', 'startRecoveryRequestSourceServer_sourceServerID' - The ID of the Source Server you want to recover.
newStartRecoveryRequestSourceServer ::
  -- | 'sourceServerID'
  Prelude.Text ->
  StartRecoveryRequestSourceServer
newStartRecoveryRequestSourceServer :: Text -> StartRecoveryRequestSourceServer
newStartRecoveryRequestSourceServer Text
pSourceServerID_ =
  StartRecoveryRequestSourceServer'
    { $sel:recoverySnapshotID:StartRecoveryRequestSourceServer' :: Maybe Text
recoverySnapshotID =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sourceServerID:StartRecoveryRequestSourceServer' :: Text
sourceServerID = Text
pSourceServerID_
    }

-- | The ID of a Recovery Snapshot we want to recover from. Omit this field
-- to launch from the latest data by taking an on-demand snapshot.
startRecoveryRequestSourceServer_recoverySnapshotID :: Lens.Lens' StartRecoveryRequestSourceServer (Prelude.Maybe Prelude.Text)
startRecoveryRequestSourceServer_recoverySnapshotID :: Lens' StartRecoveryRequestSourceServer (Maybe Text)
startRecoveryRequestSourceServer_recoverySnapshotID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRecoveryRequestSourceServer' {Maybe Text
recoverySnapshotID :: Maybe Text
$sel:recoverySnapshotID:StartRecoveryRequestSourceServer' :: StartRecoveryRequestSourceServer -> Maybe Text
recoverySnapshotID} -> Maybe Text
recoverySnapshotID) (\s :: StartRecoveryRequestSourceServer
s@StartRecoveryRequestSourceServer' {} Maybe Text
a -> StartRecoveryRequestSourceServer
s {$sel:recoverySnapshotID:StartRecoveryRequestSourceServer' :: Maybe Text
recoverySnapshotID = Maybe Text
a} :: StartRecoveryRequestSourceServer)

-- | The ID of the Source Server you want to recover.
startRecoveryRequestSourceServer_sourceServerID :: Lens.Lens' StartRecoveryRequestSourceServer Prelude.Text
startRecoveryRequestSourceServer_sourceServerID :: Lens' StartRecoveryRequestSourceServer Text
startRecoveryRequestSourceServer_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRecoveryRequestSourceServer' {Text
sourceServerID :: Text
$sel:sourceServerID:StartRecoveryRequestSourceServer' :: StartRecoveryRequestSourceServer -> Text
sourceServerID} -> Text
sourceServerID) (\s :: StartRecoveryRequestSourceServer
s@StartRecoveryRequestSourceServer' {} Text
a -> StartRecoveryRequestSourceServer
s {$sel:sourceServerID:StartRecoveryRequestSourceServer' :: Text
sourceServerID = Text
a} :: StartRecoveryRequestSourceServer)

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

instance
  Prelude.NFData
    StartRecoveryRequestSourceServer
  where
  rnf :: StartRecoveryRequestSourceServer -> ()
rnf StartRecoveryRequestSourceServer' {Maybe Text
Text
sourceServerID :: Text
recoverySnapshotID :: Maybe Text
$sel:sourceServerID:StartRecoveryRequestSourceServer' :: StartRecoveryRequestSourceServer -> Text
$sel:recoverySnapshotID:StartRecoveryRequestSourceServer' :: StartRecoveryRequestSourceServer -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recoverySnapshotID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceServerID

instance Data.ToJSON StartRecoveryRequestSourceServer where
  toJSON :: StartRecoveryRequestSourceServer -> Value
toJSON StartRecoveryRequestSourceServer' {Maybe Text
Text
sourceServerID :: Text
recoverySnapshotID :: Maybe Text
$sel:sourceServerID:StartRecoveryRequestSourceServer' :: StartRecoveryRequestSourceServer -> Text
$sel:recoverySnapshotID:StartRecoveryRequestSourceServer' :: StartRecoveryRequestSourceServer -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"recoverySnapshotID" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
recoverySnapshotID,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"sourceServerID" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sourceServerID)
          ]
      )