{-# 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.RedshiftServerLess.Types.RecoveryPoint
-- 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.RedshiftServerLess.Types.RecoveryPoint where

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

-- | The automatically created recovery point of a namespace. Recovery points
-- are created every 30 minutes and kept for 24 hours.
--
-- /See:/ 'newRecoveryPoint' smart constructor.
data RecoveryPoint = RecoveryPoint'
  { -- | The Amazon Resource Name (ARN) of the namespace the recovery point is
    -- associated with.
    RecoveryPoint -> Maybe Text
namespaceArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the namespace the recovery point is associated with.
    RecoveryPoint -> Maybe Text
namespaceName :: Prelude.Maybe Prelude.Text,
    -- | The time the recovery point is created.
    RecoveryPoint -> Maybe ISO8601
recoveryPointCreateTime :: Prelude.Maybe Data.ISO8601,
    -- | The unique identifier of the recovery point.
    RecoveryPoint -> Maybe Text
recoveryPointId :: Prelude.Maybe Prelude.Text,
    -- | The total size of the data in the recovery point in megabytes.
    RecoveryPoint -> Maybe Double
totalSizeInMegaBytes :: Prelude.Maybe Prelude.Double,
    -- | The name of the workgroup the recovery point is associated with.
    RecoveryPoint -> Maybe Text
workgroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (RecoveryPoint -> RecoveryPoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecoveryPoint -> RecoveryPoint -> Bool
$c/= :: RecoveryPoint -> RecoveryPoint -> Bool
== :: RecoveryPoint -> RecoveryPoint -> Bool
$c== :: RecoveryPoint -> RecoveryPoint -> Bool
Prelude.Eq, ReadPrec [RecoveryPoint]
ReadPrec RecoveryPoint
Int -> ReadS RecoveryPoint
ReadS [RecoveryPoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecoveryPoint]
$creadListPrec :: ReadPrec [RecoveryPoint]
readPrec :: ReadPrec RecoveryPoint
$creadPrec :: ReadPrec RecoveryPoint
readList :: ReadS [RecoveryPoint]
$creadList :: ReadS [RecoveryPoint]
readsPrec :: Int -> ReadS RecoveryPoint
$creadsPrec :: Int -> ReadS RecoveryPoint
Prelude.Read, Int -> RecoveryPoint -> ShowS
[RecoveryPoint] -> ShowS
RecoveryPoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecoveryPoint] -> ShowS
$cshowList :: [RecoveryPoint] -> ShowS
show :: RecoveryPoint -> String
$cshow :: RecoveryPoint -> String
showsPrec :: Int -> RecoveryPoint -> ShowS
$cshowsPrec :: Int -> RecoveryPoint -> ShowS
Prelude.Show, forall x. Rep RecoveryPoint x -> RecoveryPoint
forall x. RecoveryPoint -> Rep RecoveryPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecoveryPoint x -> RecoveryPoint
$cfrom :: forall x. RecoveryPoint -> Rep RecoveryPoint x
Prelude.Generic)

-- |
-- Create a value of 'RecoveryPoint' 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:
--
-- 'namespaceArn', 'recoveryPoint_namespaceArn' - The Amazon Resource Name (ARN) of the namespace the recovery point is
-- associated with.
--
-- 'namespaceName', 'recoveryPoint_namespaceName' - The name of the namespace the recovery point is associated with.
--
-- 'recoveryPointCreateTime', 'recoveryPoint_recoveryPointCreateTime' - The time the recovery point is created.
--
-- 'recoveryPointId', 'recoveryPoint_recoveryPointId' - The unique identifier of the recovery point.
--
-- 'totalSizeInMegaBytes', 'recoveryPoint_totalSizeInMegaBytes' - The total size of the data in the recovery point in megabytes.
--
-- 'workgroupName', 'recoveryPoint_workgroupName' - The name of the workgroup the recovery point is associated with.
newRecoveryPoint ::
  RecoveryPoint
newRecoveryPoint :: RecoveryPoint
newRecoveryPoint =
  RecoveryPoint'
    { $sel:namespaceArn:RecoveryPoint' :: Maybe Text
namespaceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:namespaceName:RecoveryPoint' :: Maybe Text
namespaceName = forall a. Maybe a
Prelude.Nothing,
      $sel:recoveryPointCreateTime:RecoveryPoint' :: Maybe ISO8601
recoveryPointCreateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:recoveryPointId:RecoveryPoint' :: Maybe Text
recoveryPointId = forall a. Maybe a
Prelude.Nothing,
      $sel:totalSizeInMegaBytes:RecoveryPoint' :: Maybe Double
totalSizeInMegaBytes = forall a. Maybe a
Prelude.Nothing,
      $sel:workgroupName:RecoveryPoint' :: Maybe Text
workgroupName = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the namespace the recovery point is
-- associated with.
recoveryPoint_namespaceArn :: Lens.Lens' RecoveryPoint (Prelude.Maybe Prelude.Text)
recoveryPoint_namespaceArn :: Lens' RecoveryPoint (Maybe Text)
recoveryPoint_namespaceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPoint' {Maybe Text
namespaceArn :: Maybe Text
$sel:namespaceArn:RecoveryPoint' :: RecoveryPoint -> Maybe Text
namespaceArn} -> Maybe Text
namespaceArn) (\s :: RecoveryPoint
s@RecoveryPoint' {} Maybe Text
a -> RecoveryPoint
s {$sel:namespaceArn:RecoveryPoint' :: Maybe Text
namespaceArn = Maybe Text
a} :: RecoveryPoint)

-- | The name of the namespace the recovery point is associated with.
recoveryPoint_namespaceName :: Lens.Lens' RecoveryPoint (Prelude.Maybe Prelude.Text)
recoveryPoint_namespaceName :: Lens' RecoveryPoint (Maybe Text)
recoveryPoint_namespaceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPoint' {Maybe Text
namespaceName :: Maybe Text
$sel:namespaceName:RecoveryPoint' :: RecoveryPoint -> Maybe Text
namespaceName} -> Maybe Text
namespaceName) (\s :: RecoveryPoint
s@RecoveryPoint' {} Maybe Text
a -> RecoveryPoint
s {$sel:namespaceName:RecoveryPoint' :: Maybe Text
namespaceName = Maybe Text
a} :: RecoveryPoint)

-- | The time the recovery point is created.
recoveryPoint_recoveryPointCreateTime :: Lens.Lens' RecoveryPoint (Prelude.Maybe Prelude.UTCTime)
recoveryPoint_recoveryPointCreateTime :: Lens' RecoveryPoint (Maybe UTCTime)
recoveryPoint_recoveryPointCreateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPoint' {Maybe ISO8601
recoveryPointCreateTime :: Maybe ISO8601
$sel:recoveryPointCreateTime:RecoveryPoint' :: RecoveryPoint -> Maybe ISO8601
recoveryPointCreateTime} -> Maybe ISO8601
recoveryPointCreateTime) (\s :: RecoveryPoint
s@RecoveryPoint' {} Maybe ISO8601
a -> RecoveryPoint
s {$sel:recoveryPointCreateTime:RecoveryPoint' :: Maybe ISO8601
recoveryPointCreateTime = Maybe ISO8601
a} :: RecoveryPoint) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The unique identifier of the recovery point.
recoveryPoint_recoveryPointId :: Lens.Lens' RecoveryPoint (Prelude.Maybe Prelude.Text)
recoveryPoint_recoveryPointId :: Lens' RecoveryPoint (Maybe Text)
recoveryPoint_recoveryPointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPoint' {Maybe Text
recoveryPointId :: Maybe Text
$sel:recoveryPointId:RecoveryPoint' :: RecoveryPoint -> Maybe Text
recoveryPointId} -> Maybe Text
recoveryPointId) (\s :: RecoveryPoint
s@RecoveryPoint' {} Maybe Text
a -> RecoveryPoint
s {$sel:recoveryPointId:RecoveryPoint' :: Maybe Text
recoveryPointId = Maybe Text
a} :: RecoveryPoint)

-- | The total size of the data in the recovery point in megabytes.
recoveryPoint_totalSizeInMegaBytes :: Lens.Lens' RecoveryPoint (Prelude.Maybe Prelude.Double)
recoveryPoint_totalSizeInMegaBytes :: Lens' RecoveryPoint (Maybe Double)
recoveryPoint_totalSizeInMegaBytes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPoint' {Maybe Double
totalSizeInMegaBytes :: Maybe Double
$sel:totalSizeInMegaBytes:RecoveryPoint' :: RecoveryPoint -> Maybe Double
totalSizeInMegaBytes} -> Maybe Double
totalSizeInMegaBytes) (\s :: RecoveryPoint
s@RecoveryPoint' {} Maybe Double
a -> RecoveryPoint
s {$sel:totalSizeInMegaBytes:RecoveryPoint' :: Maybe Double
totalSizeInMegaBytes = Maybe Double
a} :: RecoveryPoint)

-- | The name of the workgroup the recovery point is associated with.
recoveryPoint_workgroupName :: Lens.Lens' RecoveryPoint (Prelude.Maybe Prelude.Text)
recoveryPoint_workgroupName :: Lens' RecoveryPoint (Maybe Text)
recoveryPoint_workgroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecoveryPoint' {Maybe Text
workgroupName :: Maybe Text
$sel:workgroupName:RecoveryPoint' :: RecoveryPoint -> Maybe Text
workgroupName} -> Maybe Text
workgroupName) (\s :: RecoveryPoint
s@RecoveryPoint' {} Maybe Text
a -> RecoveryPoint
s {$sel:workgroupName:RecoveryPoint' :: Maybe Text
workgroupName = Maybe Text
a} :: RecoveryPoint)

instance Data.FromJSON RecoveryPoint where
  parseJSON :: Value -> Parser RecoveryPoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecoveryPoint"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> RecoveryPoint
RecoveryPoint'
            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
"namespaceArn")
            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
"namespaceName")
            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
"recoveryPointCreateTime")
            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
"recoveryPointId")
            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
"totalSizeInMegaBytes")
            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
"workgroupName")
      )

instance Prelude.Hashable RecoveryPoint where
  hashWithSalt :: Int -> RecoveryPoint -> Int
hashWithSalt Int
_salt RecoveryPoint' {Maybe Double
Maybe Text
Maybe ISO8601
workgroupName :: Maybe Text
totalSizeInMegaBytes :: Maybe Double
recoveryPointId :: Maybe Text
recoveryPointCreateTime :: Maybe ISO8601
namespaceName :: Maybe Text
namespaceArn :: Maybe Text
$sel:workgroupName:RecoveryPoint' :: RecoveryPoint -> Maybe Text
$sel:totalSizeInMegaBytes:RecoveryPoint' :: RecoveryPoint -> Maybe Double
$sel:recoveryPointId:RecoveryPoint' :: RecoveryPoint -> Maybe Text
$sel:recoveryPointCreateTime:RecoveryPoint' :: RecoveryPoint -> Maybe ISO8601
$sel:namespaceName:RecoveryPoint' :: RecoveryPoint -> Maybe Text
$sel:namespaceArn:RecoveryPoint' :: RecoveryPoint -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
namespaceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
namespaceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
recoveryPointCreateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recoveryPointId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
totalSizeInMegaBytes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
workgroupName

instance Prelude.NFData RecoveryPoint where
  rnf :: RecoveryPoint -> ()
rnf RecoveryPoint' {Maybe Double
Maybe Text
Maybe ISO8601
workgroupName :: Maybe Text
totalSizeInMegaBytes :: Maybe Double
recoveryPointId :: Maybe Text
recoveryPointCreateTime :: Maybe ISO8601
namespaceName :: Maybe Text
namespaceArn :: Maybe Text
$sel:workgroupName:RecoveryPoint' :: RecoveryPoint -> Maybe Text
$sel:totalSizeInMegaBytes:RecoveryPoint' :: RecoveryPoint -> Maybe Double
$sel:recoveryPointId:RecoveryPoint' :: RecoveryPoint -> Maybe Text
$sel:recoveryPointCreateTime:RecoveryPoint' :: RecoveryPoint -> Maybe ISO8601
$sel:namespaceName:RecoveryPoint' :: RecoveryPoint -> Maybe Text
$sel:namespaceArn:RecoveryPoint' :: RecoveryPoint -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
namespaceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
namespaceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
recoveryPointCreateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recoveryPointId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
totalSizeInMegaBytes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
workgroupName