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

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

-- | Represents the settings used to enable point in time recovery.
--
-- /See:/ 'newPointInTimeRecoverySpecification' smart constructor.
data PointInTimeRecoverySpecification = PointInTimeRecoverySpecification'
  { -- | Indicates whether point in time recovery is enabled (true) or disabled
    -- (false) on the table.
    PointInTimeRecoverySpecification -> Bool
pointInTimeRecoveryEnabled :: Prelude.Bool
  }
  deriving (PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
(PointInTimeRecoverySpecification
 -> PointInTimeRecoverySpecification -> Bool)
-> (PointInTimeRecoverySpecification
    -> PointInTimeRecoverySpecification -> Bool)
-> Eq PointInTimeRecoverySpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
$c/= :: PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
== :: PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
$c== :: PointInTimeRecoverySpecification
-> PointInTimeRecoverySpecification -> Bool
Prelude.Eq, ReadPrec [PointInTimeRecoverySpecification]
ReadPrec PointInTimeRecoverySpecification
Int -> ReadS PointInTimeRecoverySpecification
ReadS [PointInTimeRecoverySpecification]
(Int -> ReadS PointInTimeRecoverySpecification)
-> ReadS [PointInTimeRecoverySpecification]
-> ReadPrec PointInTimeRecoverySpecification
-> ReadPrec [PointInTimeRecoverySpecification]
-> Read PointInTimeRecoverySpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PointInTimeRecoverySpecification]
$creadListPrec :: ReadPrec [PointInTimeRecoverySpecification]
readPrec :: ReadPrec PointInTimeRecoverySpecification
$creadPrec :: ReadPrec PointInTimeRecoverySpecification
readList :: ReadS [PointInTimeRecoverySpecification]
$creadList :: ReadS [PointInTimeRecoverySpecification]
readsPrec :: Int -> ReadS PointInTimeRecoverySpecification
$creadsPrec :: Int -> ReadS PointInTimeRecoverySpecification
Prelude.Read, Int -> PointInTimeRecoverySpecification -> ShowS
[PointInTimeRecoverySpecification] -> ShowS
PointInTimeRecoverySpecification -> String
(Int -> PointInTimeRecoverySpecification -> ShowS)
-> (PointInTimeRecoverySpecification -> String)
-> ([PointInTimeRecoverySpecification] -> ShowS)
-> Show PointInTimeRecoverySpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PointInTimeRecoverySpecification] -> ShowS
$cshowList :: [PointInTimeRecoverySpecification] -> ShowS
show :: PointInTimeRecoverySpecification -> String
$cshow :: PointInTimeRecoverySpecification -> String
showsPrec :: Int -> PointInTimeRecoverySpecification -> ShowS
$cshowsPrec :: Int -> PointInTimeRecoverySpecification -> ShowS
Prelude.Show, (forall x.
 PointInTimeRecoverySpecification
 -> Rep PointInTimeRecoverySpecification x)
-> (forall x.
    Rep PointInTimeRecoverySpecification x
    -> PointInTimeRecoverySpecification)
-> Generic PointInTimeRecoverySpecification
forall x.
Rep PointInTimeRecoverySpecification x
-> PointInTimeRecoverySpecification
forall x.
PointInTimeRecoverySpecification
-> Rep PointInTimeRecoverySpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PointInTimeRecoverySpecification x
-> PointInTimeRecoverySpecification
$cfrom :: forall x.
PointInTimeRecoverySpecification
-> Rep PointInTimeRecoverySpecification x
Prelude.Generic)

-- |
-- Create a value of 'PointInTimeRecoverySpecification' 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:
--
-- 'pointInTimeRecoveryEnabled', 'pointInTimeRecoverySpecification_pointInTimeRecoveryEnabled' - Indicates whether point in time recovery is enabled (true) or disabled
-- (false) on the table.
newPointInTimeRecoverySpecification ::
  -- | 'pointInTimeRecoveryEnabled'
  Prelude.Bool ->
  PointInTimeRecoverySpecification
newPointInTimeRecoverySpecification :: Bool -> PointInTimeRecoverySpecification
newPointInTimeRecoverySpecification
  Bool
pPointInTimeRecoveryEnabled_ =
    PointInTimeRecoverySpecification' :: Bool -> PointInTimeRecoverySpecification
PointInTimeRecoverySpecification'
      { $sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: Bool
pointInTimeRecoveryEnabled =
          Bool
pPointInTimeRecoveryEnabled_
      }

-- | Indicates whether point in time recovery is enabled (true) or disabled
-- (false) on the table.
pointInTimeRecoverySpecification_pointInTimeRecoveryEnabled :: Lens.Lens' PointInTimeRecoverySpecification Prelude.Bool
pointInTimeRecoverySpecification_pointInTimeRecoveryEnabled :: (Bool -> f Bool)
-> PointInTimeRecoverySpecification
-> f PointInTimeRecoverySpecification
pointInTimeRecoverySpecification_pointInTimeRecoveryEnabled = (PointInTimeRecoverySpecification -> Bool)
-> (PointInTimeRecoverySpecification
    -> Bool -> PointInTimeRecoverySpecification)
-> Lens
     PointInTimeRecoverySpecification
     PointInTimeRecoverySpecification
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PointInTimeRecoverySpecification' {Bool
pointInTimeRecoveryEnabled :: Bool
$sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: PointInTimeRecoverySpecification -> Bool
pointInTimeRecoveryEnabled} -> Bool
pointInTimeRecoveryEnabled) (\s :: PointInTimeRecoverySpecification
s@PointInTimeRecoverySpecification' {} Bool
a -> PointInTimeRecoverySpecification
s {$sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: Bool
pointInTimeRecoveryEnabled = Bool
a} :: PointInTimeRecoverySpecification)

instance
  Prelude.Hashable
    PointInTimeRecoverySpecification

instance
  Prelude.NFData
    PointInTimeRecoverySpecification

instance Core.ToJSON PointInTimeRecoverySpecification where
  toJSON :: PointInTimeRecoverySpecification -> Value
toJSON PointInTimeRecoverySpecification' {Bool
pointInTimeRecoveryEnabled :: Bool
$sel:pointInTimeRecoveryEnabled:PointInTimeRecoverySpecification' :: PointInTimeRecoverySpecification -> Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"PointInTimeRecoveryEnabled"
                  Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
pointInTimeRecoveryEnabled
              )
          ]
      )