{-# 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-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.Redshift.Types.ClusterSnapshotCopyStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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 destination region that snapshots are automatically copied to when
    -- cross-region snapshot copy is enabled.
    ClusterSnapshotCopyStatus -> Maybe Text
destinationRegion :: Prelude.Maybe Prelude.Text,
    -- | The name of the snapshot copy grant.
    ClusterSnapshotCopyStatus -> Maybe Text
snapshotCopyGrantName :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterSnapshotCopyStatus -> ClusterSnapshotCopyStatus -> Bool
(ClusterSnapshotCopyStatus -> ClusterSnapshotCopyStatus -> Bool)
-> (ClusterSnapshotCopyStatus -> ClusterSnapshotCopyStatus -> Bool)
-> Eq ClusterSnapshotCopyStatus
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]
(Int -> ReadS ClusterSnapshotCopyStatus)
-> ReadS [ClusterSnapshotCopyStatus]
-> ReadPrec ClusterSnapshotCopyStatus
-> ReadPrec [ClusterSnapshotCopyStatus]
-> Read 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
(Int -> ClusterSnapshotCopyStatus -> ShowS)
-> (ClusterSnapshotCopyStatus -> String)
-> ([ClusterSnapshotCopyStatus] -> ShowS)
-> Show ClusterSnapshotCopyStatus
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.
 ClusterSnapshotCopyStatus -> Rep ClusterSnapshotCopyStatus x)
-> (forall x.
    Rep ClusterSnapshotCopyStatus x -> ClusterSnapshotCopyStatus)
-> Generic ClusterSnapshotCopyStatus
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:
--
-- '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.
--
-- 'destinationRegion', 'clusterSnapshotCopyStatus_destinationRegion' - The destination region that snapshots are automatically copied to when
-- cross-region snapshot copy is enabled.
--
-- 'snapshotCopyGrantName', 'clusterSnapshotCopyStatus_snapshotCopyGrantName' - The name of the snapshot copy grant.
newClusterSnapshotCopyStatus ::
  ClusterSnapshotCopyStatus
newClusterSnapshotCopyStatus :: ClusterSnapshotCopyStatus
newClusterSnapshotCopyStatus =
  ClusterSnapshotCopyStatus' :: Maybe Int
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> ClusterSnapshotCopyStatus
ClusterSnapshotCopyStatus'
    { $sel:manualSnapshotRetentionPeriod:ClusterSnapshotCopyStatus' :: Maybe Int
manualSnapshotRetentionPeriod =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:retentionPeriod:ClusterSnapshotCopyStatus' :: Maybe Integer
retentionPeriod = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationRegion:ClusterSnapshotCopyStatus' :: Maybe Text
destinationRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotCopyGrantName:ClusterSnapshotCopyStatus' :: Maybe Text
snapshotCopyGrantName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Int -> f (Maybe Int))
-> ClusterSnapshotCopyStatus -> f ClusterSnapshotCopyStatus
clusterSnapshotCopyStatus_manualSnapshotRetentionPeriod = (ClusterSnapshotCopyStatus -> Maybe Int)
-> (ClusterSnapshotCopyStatus
    -> Maybe Int -> ClusterSnapshotCopyStatus)
-> Lens
     ClusterSnapshotCopyStatus
     ClusterSnapshotCopyStatus
     (Maybe Int)
     (Maybe Int)
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 :: (Maybe Integer -> f (Maybe Integer))
-> ClusterSnapshotCopyStatus -> f ClusterSnapshotCopyStatus
clusterSnapshotCopyStatus_retentionPeriod = (ClusterSnapshotCopyStatus -> Maybe Integer)
-> (ClusterSnapshotCopyStatus
    -> Maybe Integer -> ClusterSnapshotCopyStatus)
-> Lens
     ClusterSnapshotCopyStatus
     ClusterSnapshotCopyStatus
     (Maybe Integer)
     (Maybe Integer)
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 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 :: (Maybe Text -> f (Maybe Text))
-> ClusterSnapshotCopyStatus -> f ClusterSnapshotCopyStatus
clusterSnapshotCopyStatus_destinationRegion = (ClusterSnapshotCopyStatus -> Maybe Text)
-> (ClusterSnapshotCopyStatus
    -> Maybe Text -> ClusterSnapshotCopyStatus)
-> Lens
     ClusterSnapshotCopyStatus
     ClusterSnapshotCopyStatus
     (Maybe Text)
     (Maybe Text)
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 name of the snapshot copy grant.
clusterSnapshotCopyStatus_snapshotCopyGrantName :: Lens.Lens' ClusterSnapshotCopyStatus (Prelude.Maybe Prelude.Text)
clusterSnapshotCopyStatus_snapshotCopyGrantName :: (Maybe Text -> f (Maybe Text))
-> ClusterSnapshotCopyStatus -> f ClusterSnapshotCopyStatus
clusterSnapshotCopyStatus_snapshotCopyGrantName = (ClusterSnapshotCopyStatus -> Maybe Text)
-> (ClusterSnapshotCopyStatus
    -> Maybe Text -> ClusterSnapshotCopyStatus)
-> Lens
     ClusterSnapshotCopyStatus
     ClusterSnapshotCopyStatus
     (Maybe Text)
     (Maybe Text)
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 Core.FromXML ClusterSnapshotCopyStatus where
  parseXML :: [Node] -> Either String ClusterSnapshotCopyStatus
parseXML [Node]
x =
    Maybe Int
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> ClusterSnapshotCopyStatus
ClusterSnapshotCopyStatus'
      (Maybe Int
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Text
 -> ClusterSnapshotCopyStatus)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Integer
      -> Maybe Text -> Maybe Text -> ClusterSnapshotCopyStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ManualSnapshotRetentionPeriod")
      Either
  String
  (Maybe Integer
   -> Maybe Text -> Maybe Text -> ClusterSnapshotCopyStatus)
-> Either String (Maybe Integer)
-> Either
     String (Maybe Text -> Maybe Text -> ClusterSnapshotCopyStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RetentionPeriod")
      Either
  String (Maybe Text -> Maybe Text -> ClusterSnapshotCopyStatus)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> ClusterSnapshotCopyStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DestinationRegion")
      Either String (Maybe Text -> ClusterSnapshotCopyStatus)
-> Either String (Maybe Text)
-> Either String ClusterSnapshotCopyStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SnapshotCopyGrantName")

instance Prelude.Hashable ClusterSnapshotCopyStatus

instance Prelude.NFData ClusterSnapshotCopyStatus