{-# 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.BackupDescription
-- 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.BackupDescription 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.BackupDetails
import Amazonka.DynamoDB.Types.SourceTableDetails
import Amazonka.DynamoDB.Types.SourceTableFeatureDetails
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Contains the description of the backup created for the table.
--
-- /See:/ 'newBackupDescription' smart constructor.
data BackupDescription = BackupDescription'
  { -- | Contains the details of the backup created for the table.
    BackupDescription -> Maybe BackupDetails
backupDetails :: Prelude.Maybe BackupDetails,
    -- | Contains the details of the table when the backup was created.
    BackupDescription -> Maybe SourceTableDetails
sourceTableDetails :: Prelude.Maybe SourceTableDetails,
    -- | Contains the details of the features enabled on the table when the
    -- backup was created. For example, LSIs, GSIs, streams, TTL.
    BackupDescription -> Maybe SourceTableFeatureDetails
sourceTableFeatureDetails :: Prelude.Maybe SourceTableFeatureDetails
  }
  deriving (BackupDescription -> BackupDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackupDescription -> BackupDescription -> Bool
$c/= :: BackupDescription -> BackupDescription -> Bool
== :: BackupDescription -> BackupDescription -> Bool
$c== :: BackupDescription -> BackupDescription -> Bool
Prelude.Eq, ReadPrec [BackupDescription]
ReadPrec BackupDescription
Int -> ReadS BackupDescription
ReadS [BackupDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BackupDescription]
$creadListPrec :: ReadPrec [BackupDescription]
readPrec :: ReadPrec BackupDescription
$creadPrec :: ReadPrec BackupDescription
readList :: ReadS [BackupDescription]
$creadList :: ReadS [BackupDescription]
readsPrec :: Int -> ReadS BackupDescription
$creadsPrec :: Int -> ReadS BackupDescription
Prelude.Read, Int -> BackupDescription -> ShowS
[BackupDescription] -> ShowS
BackupDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackupDescription] -> ShowS
$cshowList :: [BackupDescription] -> ShowS
show :: BackupDescription -> String
$cshow :: BackupDescription -> String
showsPrec :: Int -> BackupDescription -> ShowS
$cshowsPrec :: Int -> BackupDescription -> ShowS
Prelude.Show, forall x. Rep BackupDescription x -> BackupDescription
forall x. BackupDescription -> Rep BackupDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackupDescription x -> BackupDescription
$cfrom :: forall x. BackupDescription -> Rep BackupDescription x
Prelude.Generic)

-- |
-- Create a value of 'BackupDescription' 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:
--
-- 'backupDetails', 'backupDescription_backupDetails' - Contains the details of the backup created for the table.
--
-- 'sourceTableDetails', 'backupDescription_sourceTableDetails' - Contains the details of the table when the backup was created.
--
-- 'sourceTableFeatureDetails', 'backupDescription_sourceTableFeatureDetails' - Contains the details of the features enabled on the table when the
-- backup was created. For example, LSIs, GSIs, streams, TTL.
newBackupDescription ::
  BackupDescription
newBackupDescription :: BackupDescription
newBackupDescription =
  BackupDescription'
    { $sel:backupDetails:BackupDescription' :: Maybe BackupDetails
backupDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceTableDetails:BackupDescription' :: Maybe SourceTableDetails
sourceTableDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceTableFeatureDetails:BackupDescription' :: Maybe SourceTableFeatureDetails
sourceTableFeatureDetails = forall a. Maybe a
Prelude.Nothing
    }

-- | Contains the details of the backup created for the table.
backupDescription_backupDetails :: Lens.Lens' BackupDescription (Prelude.Maybe BackupDetails)
backupDescription_backupDetails :: Lens' BackupDescription (Maybe BackupDetails)
backupDescription_backupDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupDescription' {Maybe BackupDetails
backupDetails :: Maybe BackupDetails
$sel:backupDetails:BackupDescription' :: BackupDescription -> Maybe BackupDetails
backupDetails} -> Maybe BackupDetails
backupDetails) (\s :: BackupDescription
s@BackupDescription' {} Maybe BackupDetails
a -> BackupDescription
s {$sel:backupDetails:BackupDescription' :: Maybe BackupDetails
backupDetails = Maybe BackupDetails
a} :: BackupDescription)

-- | Contains the details of the table when the backup was created.
backupDescription_sourceTableDetails :: Lens.Lens' BackupDescription (Prelude.Maybe SourceTableDetails)
backupDescription_sourceTableDetails :: Lens' BackupDescription (Maybe SourceTableDetails)
backupDescription_sourceTableDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupDescription' {Maybe SourceTableDetails
sourceTableDetails :: Maybe SourceTableDetails
$sel:sourceTableDetails:BackupDescription' :: BackupDescription -> Maybe SourceTableDetails
sourceTableDetails} -> Maybe SourceTableDetails
sourceTableDetails) (\s :: BackupDescription
s@BackupDescription' {} Maybe SourceTableDetails
a -> BackupDescription
s {$sel:sourceTableDetails:BackupDescription' :: Maybe SourceTableDetails
sourceTableDetails = Maybe SourceTableDetails
a} :: BackupDescription)

-- | Contains the details of the features enabled on the table when the
-- backup was created. For example, LSIs, GSIs, streams, TTL.
backupDescription_sourceTableFeatureDetails :: Lens.Lens' BackupDescription (Prelude.Maybe SourceTableFeatureDetails)
backupDescription_sourceTableFeatureDetails :: Lens' BackupDescription (Maybe SourceTableFeatureDetails)
backupDescription_sourceTableFeatureDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupDescription' {Maybe SourceTableFeatureDetails
sourceTableFeatureDetails :: Maybe SourceTableFeatureDetails
$sel:sourceTableFeatureDetails:BackupDescription' :: BackupDescription -> Maybe SourceTableFeatureDetails
sourceTableFeatureDetails} -> Maybe SourceTableFeatureDetails
sourceTableFeatureDetails) (\s :: BackupDescription
s@BackupDescription' {} Maybe SourceTableFeatureDetails
a -> BackupDescription
s {$sel:sourceTableFeatureDetails:BackupDescription' :: Maybe SourceTableFeatureDetails
sourceTableFeatureDetails = Maybe SourceTableFeatureDetails
a} :: BackupDescription)

instance Data.FromJSON BackupDescription where
  parseJSON :: Value -> Parser BackupDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BackupDescription"
      ( \Object
x ->
          Maybe BackupDetails
-> Maybe SourceTableDetails
-> Maybe SourceTableFeatureDetails
-> BackupDescription
BackupDescription'
            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
"BackupDetails")
            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
"SourceTableDetails")
            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
"SourceTableFeatureDetails")
      )

instance Prelude.Hashable BackupDescription where
  hashWithSalt :: Int -> BackupDescription -> Int
hashWithSalt Int
_salt BackupDescription' {Maybe SourceTableFeatureDetails
Maybe SourceTableDetails
Maybe BackupDetails
sourceTableFeatureDetails :: Maybe SourceTableFeatureDetails
sourceTableDetails :: Maybe SourceTableDetails
backupDetails :: Maybe BackupDetails
$sel:sourceTableFeatureDetails:BackupDescription' :: BackupDescription -> Maybe SourceTableFeatureDetails
$sel:sourceTableDetails:BackupDescription' :: BackupDescription -> Maybe SourceTableDetails
$sel:backupDetails:BackupDescription' :: BackupDescription -> Maybe BackupDetails
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BackupDetails
backupDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SourceTableDetails
sourceTableDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SourceTableFeatureDetails
sourceTableFeatureDetails

instance Prelude.NFData BackupDescription where
  rnf :: BackupDescription -> ()
rnf BackupDescription' {Maybe SourceTableFeatureDetails
Maybe SourceTableDetails
Maybe BackupDetails
sourceTableFeatureDetails :: Maybe SourceTableFeatureDetails
sourceTableDetails :: Maybe SourceTableDetails
backupDetails :: Maybe BackupDetails
$sel:sourceTableFeatureDetails:BackupDescription' :: BackupDescription -> Maybe SourceTableFeatureDetails
$sel:sourceTableDetails:BackupDescription' :: BackupDescription -> Maybe SourceTableDetails
$sel:backupDetails:BackupDescription' :: BackupDescription -> Maybe BackupDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BackupDetails
backupDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SourceTableDetails
sourceTableDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SourceTableFeatureDetails
sourceTableFeatureDetails