{-# 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.ArchivalSummary
-- 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.ArchivalSummary 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 of a table archival operation.
--
-- /See:/ 'newArchivalSummary' smart constructor.
data ArchivalSummary = ArchivalSummary'
  { -- | The Amazon Resource Name (ARN) of the backup the table was archived to,
    -- when applicable in the archival reason. If you wish to restore this
    -- backup to the same table name, you will need to delete the original
    -- table.
    ArchivalSummary -> Maybe Text
archivalBackupArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time when table archival was initiated by DynamoDB, in UNIX
    -- epoch time format.
    ArchivalSummary -> Maybe POSIX
archivalDateTime :: Prelude.Maybe Data.POSIX,
    -- | The reason DynamoDB archived the table. Currently, the only possible
    -- value is:
    --
    -- -   @INACCESSIBLE_ENCRYPTION_CREDENTIALS@ - The table was archived due
    --     to the table\'s KMS key being inaccessible for more than seven days.
    --     An On-Demand backup was created at the archival time.
    ArchivalSummary -> Maybe Text
archivalReason :: Prelude.Maybe Prelude.Text
  }
  deriving (ArchivalSummary -> ArchivalSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArchivalSummary -> ArchivalSummary -> Bool
$c/= :: ArchivalSummary -> ArchivalSummary -> Bool
== :: ArchivalSummary -> ArchivalSummary -> Bool
$c== :: ArchivalSummary -> ArchivalSummary -> Bool
Prelude.Eq, ReadPrec [ArchivalSummary]
ReadPrec ArchivalSummary
Int -> ReadS ArchivalSummary
ReadS [ArchivalSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArchivalSummary]
$creadListPrec :: ReadPrec [ArchivalSummary]
readPrec :: ReadPrec ArchivalSummary
$creadPrec :: ReadPrec ArchivalSummary
readList :: ReadS [ArchivalSummary]
$creadList :: ReadS [ArchivalSummary]
readsPrec :: Int -> ReadS ArchivalSummary
$creadsPrec :: Int -> ReadS ArchivalSummary
Prelude.Read, Int -> ArchivalSummary -> ShowS
[ArchivalSummary] -> ShowS
ArchivalSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArchivalSummary] -> ShowS
$cshowList :: [ArchivalSummary] -> ShowS
show :: ArchivalSummary -> String
$cshow :: ArchivalSummary -> String
showsPrec :: Int -> ArchivalSummary -> ShowS
$cshowsPrec :: Int -> ArchivalSummary -> ShowS
Prelude.Show, forall x. Rep ArchivalSummary x -> ArchivalSummary
forall x. ArchivalSummary -> Rep ArchivalSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArchivalSummary x -> ArchivalSummary
$cfrom :: forall x. ArchivalSummary -> Rep ArchivalSummary x
Prelude.Generic)

-- |
-- Create a value of 'ArchivalSummary' 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:
--
-- 'archivalBackupArn', 'archivalSummary_archivalBackupArn' - The Amazon Resource Name (ARN) of the backup the table was archived to,
-- when applicable in the archival reason. If you wish to restore this
-- backup to the same table name, you will need to delete the original
-- table.
--
-- 'archivalDateTime', 'archivalSummary_archivalDateTime' - The date and time when table archival was initiated by DynamoDB, in UNIX
-- epoch time format.
--
-- 'archivalReason', 'archivalSummary_archivalReason' - The reason DynamoDB archived the table. Currently, the only possible
-- value is:
--
-- -   @INACCESSIBLE_ENCRYPTION_CREDENTIALS@ - The table was archived due
--     to the table\'s KMS key being inaccessible for more than seven days.
--     An On-Demand backup was created at the archival time.
newArchivalSummary ::
  ArchivalSummary
newArchivalSummary :: ArchivalSummary
newArchivalSummary =
  ArchivalSummary'
    { $sel:archivalBackupArn:ArchivalSummary' :: Maybe Text
archivalBackupArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:archivalDateTime:ArchivalSummary' :: Maybe POSIX
archivalDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:archivalReason:ArchivalSummary' :: Maybe Text
archivalReason = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the backup the table was archived to,
-- when applicable in the archival reason. If you wish to restore this
-- backup to the same table name, you will need to delete the original
-- table.
archivalSummary_archivalBackupArn :: Lens.Lens' ArchivalSummary (Prelude.Maybe Prelude.Text)
archivalSummary_archivalBackupArn :: Lens' ArchivalSummary (Maybe Text)
archivalSummary_archivalBackupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchivalSummary' {Maybe Text
archivalBackupArn :: Maybe Text
$sel:archivalBackupArn:ArchivalSummary' :: ArchivalSummary -> Maybe Text
archivalBackupArn} -> Maybe Text
archivalBackupArn) (\s :: ArchivalSummary
s@ArchivalSummary' {} Maybe Text
a -> ArchivalSummary
s {$sel:archivalBackupArn:ArchivalSummary' :: Maybe Text
archivalBackupArn = Maybe Text
a} :: ArchivalSummary)

-- | The date and time when table archival was initiated by DynamoDB, in UNIX
-- epoch time format.
archivalSummary_archivalDateTime :: Lens.Lens' ArchivalSummary (Prelude.Maybe Prelude.UTCTime)
archivalSummary_archivalDateTime :: Lens' ArchivalSummary (Maybe UTCTime)
archivalSummary_archivalDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchivalSummary' {Maybe POSIX
archivalDateTime :: Maybe POSIX
$sel:archivalDateTime:ArchivalSummary' :: ArchivalSummary -> Maybe POSIX
archivalDateTime} -> Maybe POSIX
archivalDateTime) (\s :: ArchivalSummary
s@ArchivalSummary' {} Maybe POSIX
a -> ArchivalSummary
s {$sel:archivalDateTime:ArchivalSummary' :: Maybe POSIX
archivalDateTime = Maybe POSIX
a} :: ArchivalSummary) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The reason DynamoDB archived the table. Currently, the only possible
-- value is:
--
-- -   @INACCESSIBLE_ENCRYPTION_CREDENTIALS@ - The table was archived due
--     to the table\'s KMS key being inaccessible for more than seven days.
--     An On-Demand backup was created at the archival time.
archivalSummary_archivalReason :: Lens.Lens' ArchivalSummary (Prelude.Maybe Prelude.Text)
archivalSummary_archivalReason :: Lens' ArchivalSummary (Maybe Text)
archivalSummary_archivalReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchivalSummary' {Maybe Text
archivalReason :: Maybe Text
$sel:archivalReason:ArchivalSummary' :: ArchivalSummary -> Maybe Text
archivalReason} -> Maybe Text
archivalReason) (\s :: ArchivalSummary
s@ArchivalSummary' {} Maybe Text
a -> ArchivalSummary
s {$sel:archivalReason:ArchivalSummary' :: Maybe Text
archivalReason = Maybe Text
a} :: ArchivalSummary)

instance Data.FromJSON ArchivalSummary where
  parseJSON :: Value -> Parser ArchivalSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ArchivalSummary"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> Maybe Text -> ArchivalSummary
ArchivalSummary'
            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
"ArchivalBackupArn")
            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
"ArchivalDateTime")
            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
"ArchivalReason")
      )

instance Prelude.Hashable ArchivalSummary where
  hashWithSalt :: Int -> ArchivalSummary -> Int
hashWithSalt Int
_salt ArchivalSummary' {Maybe Text
Maybe POSIX
archivalReason :: Maybe Text
archivalDateTime :: Maybe POSIX
archivalBackupArn :: Maybe Text
$sel:archivalReason:ArchivalSummary' :: ArchivalSummary -> Maybe Text
$sel:archivalDateTime:ArchivalSummary' :: ArchivalSummary -> Maybe POSIX
$sel:archivalBackupArn:ArchivalSummary' :: ArchivalSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
archivalBackupArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
archivalDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
archivalReason

instance Prelude.NFData ArchivalSummary where
  rnf :: ArchivalSummary -> ()
rnf ArchivalSummary' {Maybe Text
Maybe POSIX
archivalReason :: Maybe Text
archivalDateTime :: Maybe POSIX
archivalBackupArn :: Maybe Text
$sel:archivalReason:ArchivalSummary' :: ArchivalSummary -> Maybe Text
$sel:archivalDateTime:ArchivalSummary' :: ArchivalSummary -> Maybe POSIX
$sel:archivalBackupArn:ArchivalSummary' :: ArchivalSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
archivalBackupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
archivalDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
archivalReason