{-# 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.RecoverySnapshot
-- 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.RecoverySnapshot 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

-- | A snapshot of a Source Server used during recovery.
--
-- /See:/ 'newRecoverySnapshot' smart constructor.
data RecoverySnapshot = RecoverySnapshot'
  { -- | A list of EBS snapshots.
    RecoverySnapshot -> Maybe [Text]
ebsSnapshots :: Prelude.Maybe [Prelude.Text],
    -- | The actual timestamp that the snapshot was taken.
    RecoverySnapshot -> Maybe Text
timestamp :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of when we expect the snapshot to be taken.
    RecoverySnapshot -> Text
expectedTimestamp :: Prelude.Text,
    -- | The ID of the Recovery Snapshot.
    RecoverySnapshot -> Text
snapshotID :: Prelude.Text,
    -- | The ID of the Source Server that the snapshot was taken for.
    RecoverySnapshot -> Text
sourceServerID :: Prelude.Text
  }
  deriving (RecoverySnapshot -> RecoverySnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecoverySnapshot -> RecoverySnapshot -> Bool
$c/= :: RecoverySnapshot -> RecoverySnapshot -> Bool
== :: RecoverySnapshot -> RecoverySnapshot -> Bool
$c== :: RecoverySnapshot -> RecoverySnapshot -> Bool
Prelude.Eq, ReadPrec [RecoverySnapshot]
ReadPrec RecoverySnapshot
Int -> ReadS RecoverySnapshot
ReadS [RecoverySnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecoverySnapshot]
$creadListPrec :: ReadPrec [RecoverySnapshot]
readPrec :: ReadPrec RecoverySnapshot
$creadPrec :: ReadPrec RecoverySnapshot
readList :: ReadS [RecoverySnapshot]
$creadList :: ReadS [RecoverySnapshot]
readsPrec :: Int -> ReadS RecoverySnapshot
$creadsPrec :: Int -> ReadS RecoverySnapshot
Prelude.Read, Int -> RecoverySnapshot -> ShowS
[RecoverySnapshot] -> ShowS
RecoverySnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecoverySnapshot] -> ShowS
$cshowList :: [RecoverySnapshot] -> ShowS
show :: RecoverySnapshot -> String
$cshow :: RecoverySnapshot -> String
showsPrec :: Int -> RecoverySnapshot -> ShowS
$cshowsPrec :: Int -> RecoverySnapshot -> ShowS
Prelude.Show, forall x. Rep RecoverySnapshot x -> RecoverySnapshot
forall x. RecoverySnapshot -> Rep RecoverySnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecoverySnapshot x -> RecoverySnapshot
$cfrom :: forall x. RecoverySnapshot -> Rep RecoverySnapshot x
Prelude.Generic)

-- |
-- Create a value of 'RecoverySnapshot' 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:
--
-- 'ebsSnapshots', 'recoverySnapshot_ebsSnapshots' - A list of EBS snapshots.
--
-- 'timestamp', 'recoverySnapshot_timestamp' - The actual timestamp that the snapshot was taken.
--
-- 'expectedTimestamp', 'recoverySnapshot_expectedTimestamp' - The timestamp of when we expect the snapshot to be taken.
--
-- 'snapshotID', 'recoverySnapshot_snapshotID' - The ID of the Recovery Snapshot.
--
-- 'sourceServerID', 'recoverySnapshot_sourceServerID' - The ID of the Source Server that the snapshot was taken for.
newRecoverySnapshot ::
  -- | 'expectedTimestamp'
  Prelude.Text ->
  -- | 'snapshotID'
  Prelude.Text ->
  -- | 'sourceServerID'
  Prelude.Text ->
  RecoverySnapshot
newRecoverySnapshot :: Text -> Text -> Text -> RecoverySnapshot
newRecoverySnapshot
  Text
pExpectedTimestamp_
  Text
pSnapshotID_
  Text
pSourceServerID_ =
    RecoverySnapshot'
      { $sel:ebsSnapshots:RecoverySnapshot' :: Maybe [Text]
ebsSnapshots = forall a. Maybe a
Prelude.Nothing,
        $sel:timestamp:RecoverySnapshot' :: Maybe Text
timestamp = forall a. Maybe a
Prelude.Nothing,
        $sel:expectedTimestamp:RecoverySnapshot' :: Text
expectedTimestamp = Text
pExpectedTimestamp_,
        $sel:snapshotID:RecoverySnapshot' :: Text
snapshotID = Text
pSnapshotID_,
        $sel:sourceServerID:RecoverySnapshot' :: Text
sourceServerID = Text
pSourceServerID_
      }

-- | A list of EBS snapshots.
recoverySnapshot_ebsSnapshots :: Lens.Lens' RecoverySnapshot (Prelude.Maybe [Prelude.Text])
recoverySnapshot_ebsSnapshots :: Lens' RecoverySnapshot (Maybe [Text])
recoverySnapshot_ebsSnapshots = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoverySnapshot' {Maybe [Text]
ebsSnapshots :: Maybe [Text]
$sel:ebsSnapshots:RecoverySnapshot' :: RecoverySnapshot -> Maybe [Text]
ebsSnapshots} -> Maybe [Text]
ebsSnapshots) (\s :: RecoverySnapshot
s@RecoverySnapshot' {} Maybe [Text]
a -> RecoverySnapshot
s {$sel:ebsSnapshots:RecoverySnapshot' :: Maybe [Text]
ebsSnapshots = Maybe [Text]
a} :: RecoverySnapshot) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The actual timestamp that the snapshot was taken.
recoverySnapshot_timestamp :: Lens.Lens' RecoverySnapshot (Prelude.Maybe Prelude.Text)
recoverySnapshot_timestamp :: Lens' RecoverySnapshot (Maybe Text)
recoverySnapshot_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoverySnapshot' {Maybe Text
timestamp :: Maybe Text
$sel:timestamp:RecoverySnapshot' :: RecoverySnapshot -> Maybe Text
timestamp} -> Maybe Text
timestamp) (\s :: RecoverySnapshot
s@RecoverySnapshot' {} Maybe Text
a -> RecoverySnapshot
s {$sel:timestamp:RecoverySnapshot' :: Maybe Text
timestamp = Maybe Text
a} :: RecoverySnapshot)

-- | The timestamp of when we expect the snapshot to be taken.
recoverySnapshot_expectedTimestamp :: Lens.Lens' RecoverySnapshot Prelude.Text
recoverySnapshot_expectedTimestamp :: Lens' RecoverySnapshot Text
recoverySnapshot_expectedTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoverySnapshot' {Text
expectedTimestamp :: Text
$sel:expectedTimestamp:RecoverySnapshot' :: RecoverySnapshot -> Text
expectedTimestamp} -> Text
expectedTimestamp) (\s :: RecoverySnapshot
s@RecoverySnapshot' {} Text
a -> RecoverySnapshot
s {$sel:expectedTimestamp:RecoverySnapshot' :: Text
expectedTimestamp = Text
a} :: RecoverySnapshot)

-- | The ID of the Recovery Snapshot.
recoverySnapshot_snapshotID :: Lens.Lens' RecoverySnapshot Prelude.Text
recoverySnapshot_snapshotID :: Lens' RecoverySnapshot Text
recoverySnapshot_snapshotID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoverySnapshot' {Text
snapshotID :: Text
$sel:snapshotID:RecoverySnapshot' :: RecoverySnapshot -> Text
snapshotID} -> Text
snapshotID) (\s :: RecoverySnapshot
s@RecoverySnapshot' {} Text
a -> RecoverySnapshot
s {$sel:snapshotID:RecoverySnapshot' :: Text
snapshotID = Text
a} :: RecoverySnapshot)

-- | The ID of the Source Server that the snapshot was taken for.
recoverySnapshot_sourceServerID :: Lens.Lens' RecoverySnapshot Prelude.Text
recoverySnapshot_sourceServerID :: Lens' RecoverySnapshot Text
recoverySnapshot_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoverySnapshot' {Text
sourceServerID :: Text
$sel:sourceServerID:RecoverySnapshot' :: RecoverySnapshot -> Text
sourceServerID} -> Text
sourceServerID) (\s :: RecoverySnapshot
s@RecoverySnapshot' {} Text
a -> RecoverySnapshot
s {$sel:sourceServerID:RecoverySnapshot' :: Text
sourceServerID = Text
a} :: RecoverySnapshot)

instance Data.FromJSON RecoverySnapshot where
  parseJSON :: Value -> Parser RecoverySnapshot
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecoverySnapshot"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text -> Text -> Text -> Text -> RecoverySnapshot
RecoverySnapshot'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ebsSnapshots" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"timestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"expectedTimestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"snapshotID")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"sourceServerID")
      )

instance Prelude.Hashable RecoverySnapshot where
  hashWithSalt :: Int -> RecoverySnapshot -> Int
hashWithSalt Int
_salt RecoverySnapshot' {Maybe [Text]
Maybe Text
Text
sourceServerID :: Text
snapshotID :: Text
expectedTimestamp :: Text
timestamp :: Maybe Text
ebsSnapshots :: Maybe [Text]
$sel:sourceServerID:RecoverySnapshot' :: RecoverySnapshot -> Text
$sel:snapshotID:RecoverySnapshot' :: RecoverySnapshot -> Text
$sel:expectedTimestamp:RecoverySnapshot' :: RecoverySnapshot -> Text
$sel:timestamp:RecoverySnapshot' :: RecoverySnapshot -> Maybe Text
$sel:ebsSnapshots:RecoverySnapshot' :: RecoverySnapshot -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
ebsSnapshots
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
expectedTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceServerID

instance Prelude.NFData RecoverySnapshot where
  rnf :: RecoverySnapshot -> ()
rnf RecoverySnapshot' {Maybe [Text]
Maybe Text
Text
sourceServerID :: Text
snapshotID :: Text
expectedTimestamp :: Text
timestamp :: Maybe Text
ebsSnapshots :: Maybe [Text]
$sel:sourceServerID:RecoverySnapshot' :: RecoverySnapshot -> Text
$sel:snapshotID:RecoverySnapshot' :: RecoverySnapshot -> Text
$sel:expectedTimestamp:RecoverySnapshot' :: RecoverySnapshot -> Text
$sel:timestamp:RecoverySnapshot' :: RecoverySnapshot -> Maybe Text
$sel:ebsSnapshots:RecoverySnapshot' :: RecoverySnapshot -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
ebsSnapshots
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
expectedTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
snapshotID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceServerID