{-# 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.ContinuousBackupsDescription
-- 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.ContinuousBackupsDescription where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.ContinuousBackupsStatus
import Amazonka.DynamoDB.Types.PointInTimeRecoveryDescription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the continuous backups and point in time recovery settings on
-- the table.
--
-- /See:/ 'newContinuousBackupsDescription' smart constructor.
data ContinuousBackupsDescription = ContinuousBackupsDescription'
  { -- | The description of the point in time recovery settings applied to the
    -- table.
    ContinuousBackupsDescription
-> Maybe PointInTimeRecoveryDescription
pointInTimeRecoveryDescription :: Prelude.Maybe PointInTimeRecoveryDescription,
    -- | @ContinuousBackupsStatus@ can be one of the following states: ENABLED,
    -- DISABLED
    ContinuousBackupsDescription -> ContinuousBackupsStatus
continuousBackupsStatus :: ContinuousBackupsStatus
  }
  deriving (ContinuousBackupsDescription
-> ContinuousBackupsDescription -> Bool
(ContinuousBackupsDescription
 -> ContinuousBackupsDescription -> Bool)
-> (ContinuousBackupsDescription
    -> ContinuousBackupsDescription -> Bool)
-> Eq ContinuousBackupsDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContinuousBackupsDescription
-> ContinuousBackupsDescription -> Bool
$c/= :: ContinuousBackupsDescription
-> ContinuousBackupsDescription -> Bool
== :: ContinuousBackupsDescription
-> ContinuousBackupsDescription -> Bool
$c== :: ContinuousBackupsDescription
-> ContinuousBackupsDescription -> Bool
Prelude.Eq, ReadPrec [ContinuousBackupsDescription]
ReadPrec ContinuousBackupsDescription
Int -> ReadS ContinuousBackupsDescription
ReadS [ContinuousBackupsDescription]
(Int -> ReadS ContinuousBackupsDescription)
-> ReadS [ContinuousBackupsDescription]
-> ReadPrec ContinuousBackupsDescription
-> ReadPrec [ContinuousBackupsDescription]
-> Read ContinuousBackupsDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContinuousBackupsDescription]
$creadListPrec :: ReadPrec [ContinuousBackupsDescription]
readPrec :: ReadPrec ContinuousBackupsDescription
$creadPrec :: ReadPrec ContinuousBackupsDescription
readList :: ReadS [ContinuousBackupsDescription]
$creadList :: ReadS [ContinuousBackupsDescription]
readsPrec :: Int -> ReadS ContinuousBackupsDescription
$creadsPrec :: Int -> ReadS ContinuousBackupsDescription
Prelude.Read, Int -> ContinuousBackupsDescription -> ShowS
[ContinuousBackupsDescription] -> ShowS
ContinuousBackupsDescription -> String
(Int -> ContinuousBackupsDescription -> ShowS)
-> (ContinuousBackupsDescription -> String)
-> ([ContinuousBackupsDescription] -> ShowS)
-> Show ContinuousBackupsDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContinuousBackupsDescription] -> ShowS
$cshowList :: [ContinuousBackupsDescription] -> ShowS
show :: ContinuousBackupsDescription -> String
$cshow :: ContinuousBackupsDescription -> String
showsPrec :: Int -> ContinuousBackupsDescription -> ShowS
$cshowsPrec :: Int -> ContinuousBackupsDescription -> ShowS
Prelude.Show, (forall x.
 ContinuousBackupsDescription -> Rep ContinuousBackupsDescription x)
-> (forall x.
    Rep ContinuousBackupsDescription x -> ContinuousBackupsDescription)
-> Generic ContinuousBackupsDescription
forall x.
Rep ContinuousBackupsDescription x -> ContinuousBackupsDescription
forall x.
ContinuousBackupsDescription -> Rep ContinuousBackupsDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContinuousBackupsDescription x -> ContinuousBackupsDescription
$cfrom :: forall x.
ContinuousBackupsDescription -> Rep ContinuousBackupsDescription x
Prelude.Generic)

-- |
-- Create a value of 'ContinuousBackupsDescription' 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:
--
-- 'pointInTimeRecoveryDescription', 'continuousBackupsDescription_pointInTimeRecoveryDescription' - The description of the point in time recovery settings applied to the
-- table.
--
-- 'continuousBackupsStatus', 'continuousBackupsDescription_continuousBackupsStatus' - @ContinuousBackupsStatus@ can be one of the following states: ENABLED,
-- DISABLED
newContinuousBackupsDescription ::
  -- | 'continuousBackupsStatus'
  ContinuousBackupsStatus ->
  ContinuousBackupsDescription
newContinuousBackupsDescription :: ContinuousBackupsStatus -> ContinuousBackupsDescription
newContinuousBackupsDescription
  ContinuousBackupsStatus
pContinuousBackupsStatus_ =
    ContinuousBackupsDescription' :: Maybe PointInTimeRecoveryDescription
-> ContinuousBackupsStatus -> ContinuousBackupsDescription
ContinuousBackupsDescription'
      { $sel:pointInTimeRecoveryDescription:ContinuousBackupsDescription' :: Maybe PointInTimeRecoveryDescription
pointInTimeRecoveryDescription =
          Maybe PointInTimeRecoveryDescription
forall a. Maybe a
Prelude.Nothing,
        $sel:continuousBackupsStatus:ContinuousBackupsDescription' :: ContinuousBackupsStatus
continuousBackupsStatus =
          ContinuousBackupsStatus
pContinuousBackupsStatus_
      }

-- | The description of the point in time recovery settings applied to the
-- table.
continuousBackupsDescription_pointInTimeRecoveryDescription :: Lens.Lens' ContinuousBackupsDescription (Prelude.Maybe PointInTimeRecoveryDescription)
continuousBackupsDescription_pointInTimeRecoveryDescription :: (Maybe PointInTimeRecoveryDescription
 -> f (Maybe PointInTimeRecoveryDescription))
-> ContinuousBackupsDescription -> f ContinuousBackupsDescription
continuousBackupsDescription_pointInTimeRecoveryDescription = (ContinuousBackupsDescription
 -> Maybe PointInTimeRecoveryDescription)
-> (ContinuousBackupsDescription
    -> Maybe PointInTimeRecoveryDescription
    -> ContinuousBackupsDescription)
-> Lens
     ContinuousBackupsDescription
     ContinuousBackupsDescription
     (Maybe PointInTimeRecoveryDescription)
     (Maybe PointInTimeRecoveryDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinuousBackupsDescription' {Maybe PointInTimeRecoveryDescription
pointInTimeRecoveryDescription :: Maybe PointInTimeRecoveryDescription
$sel:pointInTimeRecoveryDescription:ContinuousBackupsDescription' :: ContinuousBackupsDescription
-> Maybe PointInTimeRecoveryDescription
pointInTimeRecoveryDescription} -> Maybe PointInTimeRecoveryDescription
pointInTimeRecoveryDescription) (\s :: ContinuousBackupsDescription
s@ContinuousBackupsDescription' {} Maybe PointInTimeRecoveryDescription
a -> ContinuousBackupsDescription
s {$sel:pointInTimeRecoveryDescription:ContinuousBackupsDescription' :: Maybe PointInTimeRecoveryDescription
pointInTimeRecoveryDescription = Maybe PointInTimeRecoveryDescription
a} :: ContinuousBackupsDescription)

-- | @ContinuousBackupsStatus@ can be one of the following states: ENABLED,
-- DISABLED
continuousBackupsDescription_continuousBackupsStatus :: Lens.Lens' ContinuousBackupsDescription ContinuousBackupsStatus
continuousBackupsDescription_continuousBackupsStatus :: (ContinuousBackupsStatus -> f ContinuousBackupsStatus)
-> ContinuousBackupsDescription -> f ContinuousBackupsDescription
continuousBackupsDescription_continuousBackupsStatus = (ContinuousBackupsDescription -> ContinuousBackupsStatus)
-> (ContinuousBackupsDescription
    -> ContinuousBackupsStatus -> ContinuousBackupsDescription)
-> Lens
     ContinuousBackupsDescription
     ContinuousBackupsDescription
     ContinuousBackupsStatus
     ContinuousBackupsStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinuousBackupsDescription' {ContinuousBackupsStatus
continuousBackupsStatus :: ContinuousBackupsStatus
$sel:continuousBackupsStatus:ContinuousBackupsDescription' :: ContinuousBackupsDescription -> ContinuousBackupsStatus
continuousBackupsStatus} -> ContinuousBackupsStatus
continuousBackupsStatus) (\s :: ContinuousBackupsDescription
s@ContinuousBackupsDescription' {} ContinuousBackupsStatus
a -> ContinuousBackupsDescription
s {$sel:continuousBackupsStatus:ContinuousBackupsDescription' :: ContinuousBackupsStatus
continuousBackupsStatus = ContinuousBackupsStatus
a} :: ContinuousBackupsDescription)

instance Core.FromJSON ContinuousBackupsDescription where
  parseJSON :: Value -> Parser ContinuousBackupsDescription
parseJSON =
    String
-> (Object -> Parser ContinuousBackupsDescription)
-> Value
-> Parser ContinuousBackupsDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContinuousBackupsDescription"
      ( \Object
x ->
          Maybe PointInTimeRecoveryDescription
-> ContinuousBackupsStatus -> ContinuousBackupsDescription
ContinuousBackupsDescription'
            (Maybe PointInTimeRecoveryDescription
 -> ContinuousBackupsStatus -> ContinuousBackupsDescription)
-> Parser (Maybe PointInTimeRecoveryDescription)
-> Parser (ContinuousBackupsStatus -> ContinuousBackupsDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe PointInTimeRecoveryDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PointInTimeRecoveryDescription")
            Parser (ContinuousBackupsStatus -> ContinuousBackupsDescription)
-> Parser ContinuousBackupsStatus
-> Parser ContinuousBackupsDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ContinuousBackupsStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ContinuousBackupsStatus")
      )

instance
  Prelude.Hashable
    ContinuousBackupsDescription

instance Prelude.NFData ContinuousBackupsDescription