{-# 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.Redshift.Types.ClusterSnapshotCopyStatus
-- 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.Redshift.Types.ClusterSnapshotCopyStatus 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
import Amazonka.Redshift.Internal

-- | Returns the destination region and retention period that are configured
-- for cross-region snapshot copy.
--
-- /See:/ 'newClusterSnapshotCopyStatus' smart constructor.
data ClusterSnapshotCopyStatus = ClusterSnapshotCopyStatus'
  { -- | The destination region that snapshots are automatically copied to when
    -- cross-region snapshot copy is enabled.
    ClusterSnapshotCopyStatus -> Maybe Text
destinationRegion :: Prelude.Maybe Prelude.Text,
    -- | The number of days that automated snapshots are retained in the
    -- destination region after they are copied from a source region. If the
    -- value is -1, the manual snapshot is retained indefinitely.
    --
    -- The value must be either -1 or an integer between 1 and 3,653.
    ClusterSnapshotCopyStatus -> Maybe Int
manualSnapshotRetentionPeriod :: Prelude.Maybe Prelude.Int,
    -- | The number of days that automated snapshots are retained in the
    -- destination region after they are copied from a source region.
    ClusterSnapshotCopyStatus -> Maybe Integer
retentionPeriod :: Prelude.Maybe Prelude.Integer,
    -- | The name of the snapshot copy grant.
    ClusterSnapshotCopyStatus -> Maybe Text
snapshotCopyGrantName :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterSnapshotCopyStatus -> ClusterSnapshotCopyStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterSnapshotCopyStatus -> ClusterSnapshotCopyStatus -> Bool
$c/= :: ClusterSnapshotCopyStatus -> ClusterSnapshotCopyStatus -> Bool
== :: ClusterSnapshotCopyStatus -> ClusterSnapshotCopyStatus -> Bool
$c== :: ClusterSnapshotCopyStatus -> ClusterSnapshotCopyStatus -> Bool
Prelude.Eq, ReadPrec [ClusterSnapshotCopyStatus]
ReadPrec ClusterSnapshotCopyStatus
Int -> ReadS ClusterSnapshotCopyStatus
ReadS [ClusterSnapshotCopyStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterSnapshotCopyStatus]
$creadListPrec :: ReadPrec [ClusterSnapshotCopyStatus]
readPrec :: ReadPrec ClusterSnapshotCopyStatus
$creadPrec :: ReadPrec ClusterSnapshotCopyStatus
readList :: ReadS [ClusterSnapshotCopyStatus]
$creadList :: ReadS [ClusterSnapshotCopyStatus]
readsPrec :: Int -> ReadS ClusterSnapshotCopyStatus
$creadsPrec :: Int -> ReadS ClusterSnapshotCopyStatus
Prelude.Read, Int -> ClusterSnapshotCopyStatus -> ShowS
[ClusterSnapshotCopyStatus] -> ShowS
ClusterSnapshotCopyStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterSnapshotCopyStatus] -> ShowS
$cshowList :: [ClusterSnapshotCopyStatus] -> ShowS
show :: ClusterSnapshotCopyStatus -> String
$cshow :: ClusterSnapshotCopyStatus -> String
showsPrec :: Int -> ClusterSnapshotCopyStatus -> ShowS
$cshowsPrec :: Int -> ClusterSnapshotCopyStatus -> ShowS
Prelude.Show, forall x.
Rep ClusterSnapshotCopyStatus x -> ClusterSnapshotCopyStatus
forall x.
ClusterSnapshotCopyStatus -> Rep ClusterSnapshotCopyStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ClusterSnapshotCopyStatus x -> ClusterSnapshotCopyStatus
$cfrom :: forall x.
ClusterSnapshotCopyStatus -> Rep ClusterSnapshotCopyStatus x
Prelude.Generic)

-- |
-- Create a value of 'ClusterSnapshotCopyStatus' 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:
--
-- 'destinationRegion', 'clusterSnapshotCopyStatus_destinationRegion' - The destination region that snapshots are automatically copied to when
-- cross-region snapshot copy is enabled.
--
-- 'manualSnapshotRetentionPeriod', 'clusterSnapshotCopyStatus_manualSnapshotRetentionPeriod' - The number of days that automated snapshots are retained in the
-- destination region after they are copied from a source region. If the
-- value is -1, the manual snapshot is retained indefinitely.
--
-- The value must be either -1 or an integer between 1 and 3,653.
--
-- 'retentionPeriod', 'clusterSnapshotCopyStatus_retentionPeriod' - The number of days that automated snapshots are retained in the
-- destination region after they are copied from a source region.
--
-- 'snapshotCopyGrantName', 'clusterSnapshotCopyStatus_snapshotCopyGrantName' - The name of the snapshot copy grant.
newClusterSnapshotCopyStatus ::
  ClusterSnapshotCopyStatus
newClusterSnapshotCopyStatus :: ClusterSnapshotCopyStatus
newClusterSnapshotCopyStatus =
  ClusterSnapshotCopyStatus'
    { $sel:destinationRegion:ClusterSnapshotCopyStatus' :: Maybe Text
destinationRegion =
        forall a. Maybe a
Prelude.Nothing,
      $sel:manualSnapshotRetentionPeriod:ClusterSnapshotCopyStatus' :: Maybe Int
manualSnapshotRetentionPeriod = forall a. Maybe a
Prelude.Nothing,
      $sel:retentionPeriod:ClusterSnapshotCopyStatus' :: Maybe Integer
retentionPeriod = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotCopyGrantName:ClusterSnapshotCopyStatus' :: Maybe Text
snapshotCopyGrantName = forall a. Maybe a
Prelude.Nothing
    }

-- | The destination region that snapshots are automatically copied to when
-- cross-region snapshot copy is enabled.
clusterSnapshotCopyStatus_destinationRegion :: Lens.Lens' ClusterSnapshotCopyStatus (Prelude.Maybe Prelude.Text)
clusterSnapshotCopyStatus_destinationRegion :: Lens' ClusterSnapshotCopyStatus (Maybe Text)
clusterSnapshotCopyStatus_destinationRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSnapshotCopyStatus' {Maybe Text
destinationRegion :: Maybe Text
$sel:destinationRegion:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Text
destinationRegion} -> Maybe Text
destinationRegion) (\s :: ClusterSnapshotCopyStatus
s@ClusterSnapshotCopyStatus' {} Maybe Text
a -> ClusterSnapshotCopyStatus
s {$sel:destinationRegion:ClusterSnapshotCopyStatus' :: Maybe Text
destinationRegion = Maybe Text
a} :: ClusterSnapshotCopyStatus)

-- | The number of days that automated snapshots are retained in the
-- destination region after they are copied from a source region. If the
-- value is -1, the manual snapshot is retained indefinitely.
--
-- The value must be either -1 or an integer between 1 and 3,653.
clusterSnapshotCopyStatus_manualSnapshotRetentionPeriod :: Lens.Lens' ClusterSnapshotCopyStatus (Prelude.Maybe Prelude.Int)
clusterSnapshotCopyStatus_manualSnapshotRetentionPeriod :: Lens' ClusterSnapshotCopyStatus (Maybe Int)
clusterSnapshotCopyStatus_manualSnapshotRetentionPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSnapshotCopyStatus' {Maybe Int
manualSnapshotRetentionPeriod :: Maybe Int
$sel:manualSnapshotRetentionPeriod:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Int
manualSnapshotRetentionPeriod} -> Maybe Int
manualSnapshotRetentionPeriod) (\s :: ClusterSnapshotCopyStatus
s@ClusterSnapshotCopyStatus' {} Maybe Int
a -> ClusterSnapshotCopyStatus
s {$sel:manualSnapshotRetentionPeriod:ClusterSnapshotCopyStatus' :: Maybe Int
manualSnapshotRetentionPeriod = Maybe Int
a} :: ClusterSnapshotCopyStatus)

-- | The number of days that automated snapshots are retained in the
-- destination region after they are copied from a source region.
clusterSnapshotCopyStatus_retentionPeriod :: Lens.Lens' ClusterSnapshotCopyStatus (Prelude.Maybe Prelude.Integer)
clusterSnapshotCopyStatus_retentionPeriod :: Lens' ClusterSnapshotCopyStatus (Maybe Integer)
clusterSnapshotCopyStatus_retentionPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSnapshotCopyStatus' {Maybe Integer
retentionPeriod :: Maybe Integer
$sel:retentionPeriod:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Integer
retentionPeriod} -> Maybe Integer
retentionPeriod) (\s :: ClusterSnapshotCopyStatus
s@ClusterSnapshotCopyStatus' {} Maybe Integer
a -> ClusterSnapshotCopyStatus
s {$sel:retentionPeriod:ClusterSnapshotCopyStatus' :: Maybe Integer
retentionPeriod = Maybe Integer
a} :: ClusterSnapshotCopyStatus)

-- | The name of the snapshot copy grant.
clusterSnapshotCopyStatus_snapshotCopyGrantName :: Lens.Lens' ClusterSnapshotCopyStatus (Prelude.Maybe Prelude.Text)
clusterSnapshotCopyStatus_snapshotCopyGrantName :: Lens' ClusterSnapshotCopyStatus (Maybe Text)
clusterSnapshotCopyStatus_snapshotCopyGrantName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterSnapshotCopyStatus' {Maybe Text
snapshotCopyGrantName :: Maybe Text
$sel:snapshotCopyGrantName:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Text
snapshotCopyGrantName} -> Maybe Text
snapshotCopyGrantName) (\s :: ClusterSnapshotCopyStatus
s@ClusterSnapshotCopyStatus' {} Maybe Text
a -> ClusterSnapshotCopyStatus
s {$sel:snapshotCopyGrantName:ClusterSnapshotCopyStatus' :: Maybe Text
snapshotCopyGrantName = Maybe Text
a} :: ClusterSnapshotCopyStatus)

instance Data.FromXML ClusterSnapshotCopyStatus where
  parseXML :: [Node] -> Either String ClusterSnapshotCopyStatus
parseXML [Node]
x =
    Maybe Text
-> Maybe Int
-> Maybe Integer
-> Maybe Text
-> ClusterSnapshotCopyStatus
ClusterSnapshotCopyStatus'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DestinationRegion")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ManualSnapshotRetentionPeriod")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"RetentionPeriod")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SnapshotCopyGrantName")

instance Prelude.Hashable ClusterSnapshotCopyStatus where
  hashWithSalt :: Int -> ClusterSnapshotCopyStatus -> Int
hashWithSalt Int
_salt ClusterSnapshotCopyStatus' {Maybe Int
Maybe Integer
Maybe Text
snapshotCopyGrantName :: Maybe Text
retentionPeriod :: Maybe Integer
manualSnapshotRetentionPeriod :: Maybe Int
destinationRegion :: Maybe Text
$sel:snapshotCopyGrantName:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Text
$sel:retentionPeriod:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Integer
$sel:manualSnapshotRetentionPeriod:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Int
$sel:destinationRegion:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
manualSnapshotRetentionPeriod
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
retentionPeriod
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotCopyGrantName

instance Prelude.NFData ClusterSnapshotCopyStatus where
  rnf :: ClusterSnapshotCopyStatus -> ()
rnf ClusterSnapshotCopyStatus' {Maybe Int
Maybe Integer
Maybe Text
snapshotCopyGrantName :: Maybe Text
retentionPeriod :: Maybe Integer
manualSnapshotRetentionPeriod :: Maybe Int
destinationRegion :: Maybe Text
$sel:snapshotCopyGrantName:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Text
$sel:retentionPeriod:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Integer
$sel:manualSnapshotRetentionPeriod:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Int
$sel:destinationRegion:ClusterSnapshotCopyStatus' :: ClusterSnapshotCopyStatus -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
manualSnapshotRetentionPeriod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
retentionPeriod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotCopyGrantName