{-# 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.KeySpaces.Types.PointInTimeRecovery
-- 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.KeySpaces.Types.PointInTimeRecovery where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KeySpaces.Types.PointInTimeRecoveryStatus
import qualified Amazonka.Prelude as Prelude

-- | Point-in-time recovery (PITR) helps protect your Amazon Keyspaces tables
-- from accidental write or delete operations by providing you continuous
-- backups of your table data.
--
-- For more information, see
-- <https://docs.aws.amazon.com/keyspaces/latest/devguide/PointInTimeRecovery.html Point-in-time recovery>
-- in the /Amazon Keyspaces Developer Guide/.
--
-- /See:/ 'newPointInTimeRecovery' smart constructor.
data PointInTimeRecovery = PointInTimeRecovery'
  { -- | The options are:
    --
    -- • @ENABLED@
    --
    -- • @DISABLED@
    PointInTimeRecovery -> PointInTimeRecoveryStatus
status :: PointInTimeRecoveryStatus
  }
  deriving (PointInTimeRecovery -> PointInTimeRecovery -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PointInTimeRecovery -> PointInTimeRecovery -> Bool
$c/= :: PointInTimeRecovery -> PointInTimeRecovery -> Bool
== :: PointInTimeRecovery -> PointInTimeRecovery -> Bool
$c== :: PointInTimeRecovery -> PointInTimeRecovery -> Bool
Prelude.Eq, ReadPrec [PointInTimeRecovery]
ReadPrec PointInTimeRecovery
Int -> ReadS PointInTimeRecovery
ReadS [PointInTimeRecovery]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PointInTimeRecovery]
$creadListPrec :: ReadPrec [PointInTimeRecovery]
readPrec :: ReadPrec PointInTimeRecovery
$creadPrec :: ReadPrec PointInTimeRecovery
readList :: ReadS [PointInTimeRecovery]
$creadList :: ReadS [PointInTimeRecovery]
readsPrec :: Int -> ReadS PointInTimeRecovery
$creadsPrec :: Int -> ReadS PointInTimeRecovery
Prelude.Read, Int -> PointInTimeRecovery -> ShowS
[PointInTimeRecovery] -> ShowS
PointInTimeRecovery -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PointInTimeRecovery] -> ShowS
$cshowList :: [PointInTimeRecovery] -> ShowS
show :: PointInTimeRecovery -> String
$cshow :: PointInTimeRecovery -> String
showsPrec :: Int -> PointInTimeRecovery -> ShowS
$cshowsPrec :: Int -> PointInTimeRecovery -> ShowS
Prelude.Show, forall x. Rep PointInTimeRecovery x -> PointInTimeRecovery
forall x. PointInTimeRecovery -> Rep PointInTimeRecovery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PointInTimeRecovery x -> PointInTimeRecovery
$cfrom :: forall x. PointInTimeRecovery -> Rep PointInTimeRecovery x
Prelude.Generic)

-- |
-- Create a value of 'PointInTimeRecovery' 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:
--
-- 'status', 'pointInTimeRecovery_status' - The options are:
--
-- • @ENABLED@
--
-- • @DISABLED@
newPointInTimeRecovery ::
  -- | 'status'
  PointInTimeRecoveryStatus ->
  PointInTimeRecovery
newPointInTimeRecovery :: PointInTimeRecoveryStatus -> PointInTimeRecovery
newPointInTimeRecovery PointInTimeRecoveryStatus
pStatus_ =
  PointInTimeRecovery' {$sel:status:PointInTimeRecovery' :: PointInTimeRecoveryStatus
status = PointInTimeRecoveryStatus
pStatus_}

-- | The options are:
--
-- • @ENABLED@
--
-- • @DISABLED@
pointInTimeRecovery_status :: Lens.Lens' PointInTimeRecovery PointInTimeRecoveryStatus
pointInTimeRecovery_status :: Lens' PointInTimeRecovery PointInTimeRecoveryStatus
pointInTimeRecovery_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PointInTimeRecovery' {PointInTimeRecoveryStatus
status :: PointInTimeRecoveryStatus
$sel:status:PointInTimeRecovery' :: PointInTimeRecovery -> PointInTimeRecoveryStatus
status} -> PointInTimeRecoveryStatus
status) (\s :: PointInTimeRecovery
s@PointInTimeRecovery' {} PointInTimeRecoveryStatus
a -> PointInTimeRecovery
s {$sel:status:PointInTimeRecovery' :: PointInTimeRecoveryStatus
status = PointInTimeRecoveryStatus
a} :: PointInTimeRecovery)

instance Prelude.Hashable PointInTimeRecovery where
  hashWithSalt :: Int -> PointInTimeRecovery -> Int
hashWithSalt Int
_salt PointInTimeRecovery' {PointInTimeRecoveryStatus
status :: PointInTimeRecoveryStatus
$sel:status:PointInTimeRecovery' :: PointInTimeRecovery -> PointInTimeRecoveryStatus
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PointInTimeRecoveryStatus
status

instance Prelude.NFData PointInTimeRecovery where
  rnf :: PointInTimeRecovery -> ()
rnf PointInTimeRecovery' {PointInTimeRecoveryStatus
status :: PointInTimeRecoveryStatus
$sel:status:PointInTimeRecovery' :: PointInTimeRecovery -> PointInTimeRecoveryStatus
..} = forall a. NFData a => a -> ()
Prelude.rnf PointInTimeRecoveryStatus
status

instance Data.ToJSON PointInTimeRecovery where
  toJSON :: PointInTimeRecovery -> Value
toJSON PointInTimeRecovery' {PointInTimeRecoveryStatus
status :: PointInTimeRecoveryStatus
$sel:status:PointInTimeRecovery' :: PointInTimeRecovery -> PointInTimeRecoveryStatus
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"status" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PointInTimeRecoveryStatus
status)]
      )