{-# 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.SecurityHub.Types.AwsDynamoDbTableRestoreSummary
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SecurityHub.Types.AwsDynamoDbTableRestoreSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the restore for the table.
--
-- /See:/ 'newAwsDynamoDbTableRestoreSummary' smart constructor.
data AwsDynamoDbTableRestoreSummary = AwsDynamoDbTableRestoreSummary'
  { -- | The ARN of the source table for the backup.
    AwsDynamoDbTableRestoreSummary -> Maybe Text
sourceTableArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the source backup from which the table was restored.
    AwsDynamoDbTableRestoreSummary -> Maybe Text
sourceBackupArn :: Prelude.Maybe Prelude.Text,
    -- | Whether a restore is currently in progress.
    AwsDynamoDbTableRestoreSummary -> Maybe Bool
restoreInProgress :: Prelude.Maybe Prelude.Bool,
    -- | Indicates the point in time that the table was restored to.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsDynamoDbTableRestoreSummary -> Maybe Text
restoreDateTime :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsDynamoDbTableRestoreSummary
-> AwsDynamoDbTableRestoreSummary -> Bool
(AwsDynamoDbTableRestoreSummary
 -> AwsDynamoDbTableRestoreSummary -> Bool)
-> (AwsDynamoDbTableRestoreSummary
    -> AwsDynamoDbTableRestoreSummary -> Bool)
-> Eq AwsDynamoDbTableRestoreSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsDynamoDbTableRestoreSummary
-> AwsDynamoDbTableRestoreSummary -> Bool
$c/= :: AwsDynamoDbTableRestoreSummary
-> AwsDynamoDbTableRestoreSummary -> Bool
== :: AwsDynamoDbTableRestoreSummary
-> AwsDynamoDbTableRestoreSummary -> Bool
$c== :: AwsDynamoDbTableRestoreSummary
-> AwsDynamoDbTableRestoreSummary -> Bool
Prelude.Eq, ReadPrec [AwsDynamoDbTableRestoreSummary]
ReadPrec AwsDynamoDbTableRestoreSummary
Int -> ReadS AwsDynamoDbTableRestoreSummary
ReadS [AwsDynamoDbTableRestoreSummary]
(Int -> ReadS AwsDynamoDbTableRestoreSummary)
-> ReadS [AwsDynamoDbTableRestoreSummary]
-> ReadPrec AwsDynamoDbTableRestoreSummary
-> ReadPrec [AwsDynamoDbTableRestoreSummary]
-> Read AwsDynamoDbTableRestoreSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsDynamoDbTableRestoreSummary]
$creadListPrec :: ReadPrec [AwsDynamoDbTableRestoreSummary]
readPrec :: ReadPrec AwsDynamoDbTableRestoreSummary
$creadPrec :: ReadPrec AwsDynamoDbTableRestoreSummary
readList :: ReadS [AwsDynamoDbTableRestoreSummary]
$creadList :: ReadS [AwsDynamoDbTableRestoreSummary]
readsPrec :: Int -> ReadS AwsDynamoDbTableRestoreSummary
$creadsPrec :: Int -> ReadS AwsDynamoDbTableRestoreSummary
Prelude.Read, Int -> AwsDynamoDbTableRestoreSummary -> ShowS
[AwsDynamoDbTableRestoreSummary] -> ShowS
AwsDynamoDbTableRestoreSummary -> String
(Int -> AwsDynamoDbTableRestoreSummary -> ShowS)
-> (AwsDynamoDbTableRestoreSummary -> String)
-> ([AwsDynamoDbTableRestoreSummary] -> ShowS)
-> Show AwsDynamoDbTableRestoreSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsDynamoDbTableRestoreSummary] -> ShowS
$cshowList :: [AwsDynamoDbTableRestoreSummary] -> ShowS
show :: AwsDynamoDbTableRestoreSummary -> String
$cshow :: AwsDynamoDbTableRestoreSummary -> String
showsPrec :: Int -> AwsDynamoDbTableRestoreSummary -> ShowS
$cshowsPrec :: Int -> AwsDynamoDbTableRestoreSummary -> ShowS
Prelude.Show, (forall x.
 AwsDynamoDbTableRestoreSummary
 -> Rep AwsDynamoDbTableRestoreSummary x)
-> (forall x.
    Rep AwsDynamoDbTableRestoreSummary x
    -> AwsDynamoDbTableRestoreSummary)
-> Generic AwsDynamoDbTableRestoreSummary
forall x.
Rep AwsDynamoDbTableRestoreSummary x
-> AwsDynamoDbTableRestoreSummary
forall x.
AwsDynamoDbTableRestoreSummary
-> Rep AwsDynamoDbTableRestoreSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsDynamoDbTableRestoreSummary x
-> AwsDynamoDbTableRestoreSummary
$cfrom :: forall x.
AwsDynamoDbTableRestoreSummary
-> Rep AwsDynamoDbTableRestoreSummary x
Prelude.Generic)

-- |
-- Create a value of 'AwsDynamoDbTableRestoreSummary' 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:
--
-- 'sourceTableArn', 'awsDynamoDbTableRestoreSummary_sourceTableArn' - The ARN of the source table for the backup.
--
-- 'sourceBackupArn', 'awsDynamoDbTableRestoreSummary_sourceBackupArn' - The ARN of the source backup from which the table was restored.
--
-- 'restoreInProgress', 'awsDynamoDbTableRestoreSummary_restoreInProgress' - Whether a restore is currently in progress.
--
-- 'restoreDateTime', 'awsDynamoDbTableRestoreSummary_restoreDateTime' - Indicates the point in time that the table was restored to.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
newAwsDynamoDbTableRestoreSummary ::
  AwsDynamoDbTableRestoreSummary
newAwsDynamoDbTableRestoreSummary :: AwsDynamoDbTableRestoreSummary
newAwsDynamoDbTableRestoreSummary =
  AwsDynamoDbTableRestoreSummary' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> AwsDynamoDbTableRestoreSummary
AwsDynamoDbTableRestoreSummary'
    { $sel:sourceTableArn:AwsDynamoDbTableRestoreSummary' :: Maybe Text
sourceTableArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceBackupArn:AwsDynamoDbTableRestoreSummary' :: Maybe Text
sourceBackupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:restoreInProgress:AwsDynamoDbTableRestoreSummary' :: Maybe Bool
restoreInProgress = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:restoreDateTime:AwsDynamoDbTableRestoreSummary' :: Maybe Text
restoreDateTime = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the source table for the backup.
awsDynamoDbTableRestoreSummary_sourceTableArn :: Lens.Lens' AwsDynamoDbTableRestoreSummary (Prelude.Maybe Prelude.Text)
awsDynamoDbTableRestoreSummary_sourceTableArn :: (Maybe Text -> f (Maybe Text))
-> AwsDynamoDbTableRestoreSummary
-> f AwsDynamoDbTableRestoreSummary
awsDynamoDbTableRestoreSummary_sourceTableArn = (AwsDynamoDbTableRestoreSummary -> Maybe Text)
-> (AwsDynamoDbTableRestoreSummary
    -> Maybe Text -> AwsDynamoDbTableRestoreSummary)
-> Lens
     AwsDynamoDbTableRestoreSummary
     AwsDynamoDbTableRestoreSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableRestoreSummary' {Maybe Text
sourceTableArn :: Maybe Text
$sel:sourceTableArn:AwsDynamoDbTableRestoreSummary' :: AwsDynamoDbTableRestoreSummary -> Maybe Text
sourceTableArn} -> Maybe Text
sourceTableArn) (\s :: AwsDynamoDbTableRestoreSummary
s@AwsDynamoDbTableRestoreSummary' {} Maybe Text
a -> AwsDynamoDbTableRestoreSummary
s {$sel:sourceTableArn:AwsDynamoDbTableRestoreSummary' :: Maybe Text
sourceTableArn = Maybe Text
a} :: AwsDynamoDbTableRestoreSummary)

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

-- | Whether a restore is currently in progress.
awsDynamoDbTableRestoreSummary_restoreInProgress :: Lens.Lens' AwsDynamoDbTableRestoreSummary (Prelude.Maybe Prelude.Bool)
awsDynamoDbTableRestoreSummary_restoreInProgress :: (Maybe Bool -> f (Maybe Bool))
-> AwsDynamoDbTableRestoreSummary
-> f AwsDynamoDbTableRestoreSummary
awsDynamoDbTableRestoreSummary_restoreInProgress = (AwsDynamoDbTableRestoreSummary -> Maybe Bool)
-> (AwsDynamoDbTableRestoreSummary
    -> Maybe Bool -> AwsDynamoDbTableRestoreSummary)
-> Lens
     AwsDynamoDbTableRestoreSummary
     AwsDynamoDbTableRestoreSummary
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableRestoreSummary' {Maybe Bool
restoreInProgress :: Maybe Bool
$sel:restoreInProgress:AwsDynamoDbTableRestoreSummary' :: AwsDynamoDbTableRestoreSummary -> Maybe Bool
restoreInProgress} -> Maybe Bool
restoreInProgress) (\s :: AwsDynamoDbTableRestoreSummary
s@AwsDynamoDbTableRestoreSummary' {} Maybe Bool
a -> AwsDynamoDbTableRestoreSummary
s {$sel:restoreInProgress:AwsDynamoDbTableRestoreSummary' :: Maybe Bool
restoreInProgress = Maybe Bool
a} :: AwsDynamoDbTableRestoreSummary)

-- | Indicates the point in time that the table was restored to.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsDynamoDbTableRestoreSummary_restoreDateTime :: Lens.Lens' AwsDynamoDbTableRestoreSummary (Prelude.Maybe Prelude.Text)
awsDynamoDbTableRestoreSummary_restoreDateTime :: (Maybe Text -> f (Maybe Text))
-> AwsDynamoDbTableRestoreSummary
-> f AwsDynamoDbTableRestoreSummary
awsDynamoDbTableRestoreSummary_restoreDateTime = (AwsDynamoDbTableRestoreSummary -> Maybe Text)
-> (AwsDynamoDbTableRestoreSummary
    -> Maybe Text -> AwsDynamoDbTableRestoreSummary)
-> Lens
     AwsDynamoDbTableRestoreSummary
     AwsDynamoDbTableRestoreSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableRestoreSummary' {Maybe Text
restoreDateTime :: Maybe Text
$sel:restoreDateTime:AwsDynamoDbTableRestoreSummary' :: AwsDynamoDbTableRestoreSummary -> Maybe Text
restoreDateTime} -> Maybe Text
restoreDateTime) (\s :: AwsDynamoDbTableRestoreSummary
s@AwsDynamoDbTableRestoreSummary' {} Maybe Text
a -> AwsDynamoDbTableRestoreSummary
s {$sel:restoreDateTime:AwsDynamoDbTableRestoreSummary' :: Maybe Text
restoreDateTime = Maybe Text
a} :: AwsDynamoDbTableRestoreSummary)

instance Core.FromJSON AwsDynamoDbTableRestoreSummary where
  parseJSON :: Value -> Parser AwsDynamoDbTableRestoreSummary
parseJSON =
    String
-> (Object -> Parser AwsDynamoDbTableRestoreSummary)
-> Value
-> Parser AwsDynamoDbTableRestoreSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsDynamoDbTableRestoreSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> AwsDynamoDbTableRestoreSummary
AwsDynamoDbTableRestoreSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> AwsDynamoDbTableRestoreSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool -> Maybe Text -> AwsDynamoDbTableRestoreSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceTableArn")
            Parser
  (Maybe Text
   -> Maybe Bool -> Maybe Text -> AwsDynamoDbTableRestoreSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Text -> AwsDynamoDbTableRestoreSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceBackupArn")
            Parser (Maybe Bool -> Maybe Text -> AwsDynamoDbTableRestoreSummary)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> AwsDynamoDbTableRestoreSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RestoreInProgress")
            Parser (Maybe Text -> AwsDynamoDbTableRestoreSummary)
-> Parser (Maybe Text) -> Parser AwsDynamoDbTableRestoreSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RestoreDateTime")
      )

instance
  Prelude.Hashable
    AwsDynamoDbTableRestoreSummary

instance
  Prelude.NFData
    AwsDynamoDbTableRestoreSummary

instance Core.ToJSON AwsDynamoDbTableRestoreSummary where
  toJSON :: AwsDynamoDbTableRestoreSummary -> Value
toJSON AwsDynamoDbTableRestoreSummary' {Maybe Bool
Maybe Text
restoreDateTime :: Maybe Text
restoreInProgress :: Maybe Bool
sourceBackupArn :: Maybe Text
sourceTableArn :: Maybe Text
$sel:restoreDateTime:AwsDynamoDbTableRestoreSummary' :: AwsDynamoDbTableRestoreSummary -> Maybe Text
$sel:restoreInProgress:AwsDynamoDbTableRestoreSummary' :: AwsDynamoDbTableRestoreSummary -> Maybe Bool
$sel:sourceBackupArn:AwsDynamoDbTableRestoreSummary' :: AwsDynamoDbTableRestoreSummary -> Maybe Text
$sel:sourceTableArn:AwsDynamoDbTableRestoreSummary' :: AwsDynamoDbTableRestoreSummary -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SourceTableArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceTableArn,
            (Text
"SourceBackupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceBackupArn,
            (Text
"RestoreInProgress" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
restoreInProgress,
            (Text
"RestoreDateTime" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
restoreDateTime
          ]
      )