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

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.BackupDetails
import Amazonka.DynamoDB.Types.SourceTableDetails
import Amazonka.DynamoDB.Types.SourceTableFeatureDetails
import qualified Amazonka.Lens as Lens
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
(BackupDescription -> BackupDescription -> Bool)
-> (BackupDescription -> BackupDescription -> Bool)
-> Eq BackupDescription
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]
(Int -> ReadS BackupDescription)
-> ReadS [BackupDescription]
-> ReadPrec BackupDescription
-> ReadPrec [BackupDescription]
-> Read 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
(Int -> BackupDescription -> ShowS)
-> (BackupDescription -> String)
-> ([BackupDescription] -> ShowS)
-> Show BackupDescription
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. BackupDescription -> Rep BackupDescription x)
-> (forall x. Rep BackupDescription x -> BackupDescription)
-> Generic BackupDescription
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' :: Maybe BackupDetails
-> Maybe SourceTableDetails
-> Maybe SourceTableFeatureDetails
-> BackupDescription
BackupDescription'
    { $sel:backupDetails:BackupDescription' :: Maybe BackupDetails
backupDetails = Maybe BackupDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceTableDetails:BackupDescription' :: Maybe SourceTableDetails
sourceTableDetails = Maybe SourceTableDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceTableFeatureDetails:BackupDescription' :: Maybe SourceTableFeatureDetails
sourceTableFeatureDetails = Maybe 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 :: (Maybe BackupDetails -> f (Maybe BackupDetails))
-> BackupDescription -> f BackupDescription
backupDescription_backupDetails = (BackupDescription -> Maybe BackupDetails)
-> (BackupDescription -> Maybe BackupDetails -> BackupDescription)
-> Lens
     BackupDescription
     BackupDescription
     (Maybe BackupDetails)
     (Maybe 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 :: (Maybe SourceTableDetails -> f (Maybe SourceTableDetails))
-> BackupDescription -> f BackupDescription
backupDescription_sourceTableDetails = (BackupDescription -> Maybe SourceTableDetails)
-> (BackupDescription
    -> Maybe SourceTableDetails -> BackupDescription)
-> Lens
     BackupDescription
     BackupDescription
     (Maybe SourceTableDetails)
     (Maybe 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 :: (Maybe SourceTableFeatureDetails
 -> f (Maybe SourceTableFeatureDetails))
-> BackupDescription -> f BackupDescription
backupDescription_sourceTableFeatureDetails = (BackupDescription -> Maybe SourceTableFeatureDetails)
-> (BackupDescription
    -> Maybe SourceTableFeatureDetails -> BackupDescription)
-> Lens
     BackupDescription
     BackupDescription
     (Maybe SourceTableFeatureDetails)
     (Maybe 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 Core.FromJSON BackupDescription where
  parseJSON :: Value -> Parser BackupDescription
parseJSON =
    String
-> (Object -> Parser BackupDescription)
-> Value
-> Parser BackupDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BackupDescription"
      ( \Object
x ->
          Maybe BackupDetails
-> Maybe SourceTableDetails
-> Maybe SourceTableFeatureDetails
-> BackupDescription
BackupDescription'
            (Maybe BackupDetails
 -> Maybe SourceTableDetails
 -> Maybe SourceTableFeatureDetails
 -> BackupDescription)
-> Parser (Maybe BackupDetails)
-> Parser
     (Maybe SourceTableDetails
      -> Maybe SourceTableFeatureDetails -> BackupDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe BackupDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BackupDetails")
            Parser
  (Maybe SourceTableDetails
   -> Maybe SourceTableFeatureDetails -> BackupDescription)
-> Parser (Maybe SourceTableDetails)
-> Parser (Maybe SourceTableFeatureDetails -> BackupDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SourceTableDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceTableDetails")
            Parser (Maybe SourceTableFeatureDetails -> BackupDescription)
-> Parser (Maybe SourceTableFeatureDetails)
-> Parser BackupDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SourceTableFeatureDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceTableFeatureDetails")
      )

instance Prelude.Hashable BackupDescription

instance Prelude.NFData BackupDescription