{-# 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.DynamoDB.Types.RestoreSummary
-- 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.DynamoDB.Types.RestoreSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Contains details for the restore.
--
-- /See:/ 'newRestoreSummary' smart constructor.
data RestoreSummary = RestoreSummary'
  { -- | The Amazon Resource Name (ARN) of the backup from which the table was
    -- restored.
    RestoreSummary -> Maybe Text
sourceBackupArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the source table of the backup that is being restored.
    RestoreSummary -> Maybe Text
sourceTableArn :: Prelude.Maybe Prelude.Text,
    -- | Point in time or source backup time.
    RestoreSummary -> POSIX
restoreDateTime :: Data.POSIX,
    -- | Indicates if a restore is in progress or not.
    RestoreSummary -> Bool
restoreInProgress :: Prelude.Bool
  }
  deriving (RestoreSummary -> RestoreSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreSummary -> RestoreSummary -> Bool
$c/= :: RestoreSummary -> RestoreSummary -> Bool
== :: RestoreSummary -> RestoreSummary -> Bool
$c== :: RestoreSummary -> RestoreSummary -> Bool
Prelude.Eq, ReadPrec [RestoreSummary]
ReadPrec RestoreSummary
Int -> ReadS RestoreSummary
ReadS [RestoreSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreSummary]
$creadListPrec :: ReadPrec [RestoreSummary]
readPrec :: ReadPrec RestoreSummary
$creadPrec :: ReadPrec RestoreSummary
readList :: ReadS [RestoreSummary]
$creadList :: ReadS [RestoreSummary]
readsPrec :: Int -> ReadS RestoreSummary
$creadsPrec :: Int -> ReadS RestoreSummary
Prelude.Read, Int -> RestoreSummary -> ShowS
[RestoreSummary] -> ShowS
RestoreSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreSummary] -> ShowS
$cshowList :: [RestoreSummary] -> ShowS
show :: RestoreSummary -> String
$cshow :: RestoreSummary -> String
showsPrec :: Int -> RestoreSummary -> ShowS
$cshowsPrec :: Int -> RestoreSummary -> ShowS
Prelude.Show, forall x. Rep RestoreSummary x -> RestoreSummary
forall x. RestoreSummary -> Rep RestoreSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RestoreSummary x -> RestoreSummary
$cfrom :: forall x. RestoreSummary -> Rep RestoreSummary x
Prelude.Generic)

-- |
-- Create a value of 'RestoreSummary' 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:
--
-- 'sourceBackupArn', 'restoreSummary_sourceBackupArn' - The Amazon Resource Name (ARN) of the backup from which the table was
-- restored.
--
-- 'sourceTableArn', 'restoreSummary_sourceTableArn' - The ARN of the source table of the backup that is being restored.
--
-- 'restoreDateTime', 'restoreSummary_restoreDateTime' - Point in time or source backup time.
--
-- 'restoreInProgress', 'restoreSummary_restoreInProgress' - Indicates if a restore is in progress or not.
newRestoreSummary ::
  -- | 'restoreDateTime'
  Prelude.UTCTime ->
  -- | 'restoreInProgress'
  Prelude.Bool ->
  RestoreSummary
newRestoreSummary :: UTCTime -> Bool -> RestoreSummary
newRestoreSummary
  UTCTime
pRestoreDateTime_
  Bool
pRestoreInProgress_ =
    RestoreSummary'
      { $sel:sourceBackupArn:RestoreSummary' :: Maybe Text
sourceBackupArn = forall a. Maybe a
Prelude.Nothing,
        $sel:sourceTableArn:RestoreSummary' :: Maybe Text
sourceTableArn = forall a. Maybe a
Prelude.Nothing,
        $sel:restoreDateTime:RestoreSummary' :: POSIX
restoreDateTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pRestoreDateTime_,
        $sel:restoreInProgress:RestoreSummary' :: Bool
restoreInProgress = Bool
pRestoreInProgress_
      }

-- | The Amazon Resource Name (ARN) of the backup from which the table was
-- restored.
restoreSummary_sourceBackupArn :: Lens.Lens' RestoreSummary (Prelude.Maybe Prelude.Text)
restoreSummary_sourceBackupArn :: Lens' RestoreSummary (Maybe Text)
restoreSummary_sourceBackupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreSummary' {Maybe Text
sourceBackupArn :: Maybe Text
$sel:sourceBackupArn:RestoreSummary' :: RestoreSummary -> Maybe Text
sourceBackupArn} -> Maybe Text
sourceBackupArn) (\s :: RestoreSummary
s@RestoreSummary' {} Maybe Text
a -> RestoreSummary
s {$sel:sourceBackupArn:RestoreSummary' :: Maybe Text
sourceBackupArn = Maybe Text
a} :: RestoreSummary)

-- | The ARN of the source table of the backup that is being restored.
restoreSummary_sourceTableArn :: Lens.Lens' RestoreSummary (Prelude.Maybe Prelude.Text)
restoreSummary_sourceTableArn :: Lens' RestoreSummary (Maybe Text)
restoreSummary_sourceTableArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreSummary' {Maybe Text
sourceTableArn :: Maybe Text
$sel:sourceTableArn:RestoreSummary' :: RestoreSummary -> Maybe Text
sourceTableArn} -> Maybe Text
sourceTableArn) (\s :: RestoreSummary
s@RestoreSummary' {} Maybe Text
a -> RestoreSummary
s {$sel:sourceTableArn:RestoreSummary' :: Maybe Text
sourceTableArn = Maybe Text
a} :: RestoreSummary)

-- | Point in time or source backup time.
restoreSummary_restoreDateTime :: Lens.Lens' RestoreSummary Prelude.UTCTime
restoreSummary_restoreDateTime :: Lens' RestoreSummary UTCTime
restoreSummary_restoreDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreSummary' {POSIX
restoreDateTime :: POSIX
$sel:restoreDateTime:RestoreSummary' :: RestoreSummary -> POSIX
restoreDateTime} -> POSIX
restoreDateTime) (\s :: RestoreSummary
s@RestoreSummary' {} POSIX
a -> RestoreSummary
s {$sel:restoreDateTime:RestoreSummary' :: POSIX
restoreDateTime = POSIX
a} :: RestoreSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Indicates if a restore is in progress or not.
restoreSummary_restoreInProgress :: Lens.Lens' RestoreSummary Prelude.Bool
restoreSummary_restoreInProgress :: Lens' RestoreSummary Bool
restoreSummary_restoreInProgress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreSummary' {Bool
restoreInProgress :: Bool
$sel:restoreInProgress:RestoreSummary' :: RestoreSummary -> Bool
restoreInProgress} -> Bool
restoreInProgress) (\s :: RestoreSummary
s@RestoreSummary' {} Bool
a -> RestoreSummary
s {$sel:restoreInProgress:RestoreSummary' :: Bool
restoreInProgress = Bool
a} :: RestoreSummary)

instance Data.FromJSON RestoreSummary where
  parseJSON :: Value -> Parser RestoreSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RestoreSummary"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> POSIX -> Bool -> RestoreSummary
RestoreSummary'
            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
"SourceBackupArn")
            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
"SourceTableArn")
            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
"RestoreDateTime")
            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
"RestoreInProgress")
      )

instance Prelude.Hashable RestoreSummary where
  hashWithSalt :: Int -> RestoreSummary -> Int
hashWithSalt Int
_salt RestoreSummary' {Bool
Maybe Text
POSIX
restoreInProgress :: Bool
restoreDateTime :: POSIX
sourceTableArn :: Maybe Text
sourceBackupArn :: Maybe Text
$sel:restoreInProgress:RestoreSummary' :: RestoreSummary -> Bool
$sel:restoreDateTime:RestoreSummary' :: RestoreSummary -> POSIX
$sel:sourceTableArn:RestoreSummary' :: RestoreSummary -> Maybe Text
$sel:sourceBackupArn:RestoreSummary' :: RestoreSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceBackupArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceTableArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
restoreDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
restoreInProgress

instance Prelude.NFData RestoreSummary where
  rnf :: RestoreSummary -> ()
rnf RestoreSummary' {Bool
Maybe Text
POSIX
restoreInProgress :: Bool
restoreDateTime :: POSIX
sourceTableArn :: Maybe Text
sourceBackupArn :: Maybe Text
$sel:restoreInProgress:RestoreSummary' :: RestoreSummary -> Bool
$sel:restoreDateTime:RestoreSummary' :: RestoreSummary -> POSIX
$sel:sourceTableArn:RestoreSummary' :: RestoreSummary -> Maybe Text
$sel:sourceBackupArn:RestoreSummary' :: RestoreSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceBackupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceTableArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
restoreDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
restoreInProgress