{-# 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.CloudHSMV2.Types.DestinationBackup
-- 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.CloudHSMV2.Types.DestinationBackup 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

-- | Contains information about the backup that will be copied and created by
-- the CopyBackupToRegion operation.
--
-- /See:/ 'newDestinationBackup' smart constructor.
data DestinationBackup = DestinationBackup'
  { -- | The date and time when both the source backup was created.
    DestinationBackup -> Maybe POSIX
createTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The identifier (ID) of the source backup from which the new backup was
    -- copied.
    DestinationBackup -> Maybe Text
sourceBackup :: Prelude.Maybe Prelude.Text,
    -- | The identifier (ID) of the cluster containing the source backup from
    -- which the new backup was copied.
    DestinationBackup -> Maybe Text
sourceCluster :: Prelude.Maybe Prelude.Text,
    -- | The AWS region that contains the source backup from which the new backup
    -- was copied.
    DestinationBackup -> Maybe Text
sourceRegion :: Prelude.Maybe Prelude.Text
  }
  deriving (DestinationBackup -> DestinationBackup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationBackup -> DestinationBackup -> Bool
$c/= :: DestinationBackup -> DestinationBackup -> Bool
== :: DestinationBackup -> DestinationBackup -> Bool
$c== :: DestinationBackup -> DestinationBackup -> Bool
Prelude.Eq, ReadPrec [DestinationBackup]
ReadPrec DestinationBackup
Int -> ReadS DestinationBackup
ReadS [DestinationBackup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationBackup]
$creadListPrec :: ReadPrec [DestinationBackup]
readPrec :: ReadPrec DestinationBackup
$creadPrec :: ReadPrec DestinationBackup
readList :: ReadS [DestinationBackup]
$creadList :: ReadS [DestinationBackup]
readsPrec :: Int -> ReadS DestinationBackup
$creadsPrec :: Int -> ReadS DestinationBackup
Prelude.Read, Int -> DestinationBackup -> ShowS
[DestinationBackup] -> ShowS
DestinationBackup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationBackup] -> ShowS
$cshowList :: [DestinationBackup] -> ShowS
show :: DestinationBackup -> String
$cshow :: DestinationBackup -> String
showsPrec :: Int -> DestinationBackup -> ShowS
$cshowsPrec :: Int -> DestinationBackup -> ShowS
Prelude.Show, forall x. Rep DestinationBackup x -> DestinationBackup
forall x. DestinationBackup -> Rep DestinationBackup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DestinationBackup x -> DestinationBackup
$cfrom :: forall x. DestinationBackup -> Rep DestinationBackup x
Prelude.Generic)

-- |
-- Create a value of 'DestinationBackup' 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:
--
-- 'createTimestamp', 'destinationBackup_createTimestamp' - The date and time when both the source backup was created.
--
-- 'sourceBackup', 'destinationBackup_sourceBackup' - The identifier (ID) of the source backup from which the new backup was
-- copied.
--
-- 'sourceCluster', 'destinationBackup_sourceCluster' - The identifier (ID) of the cluster containing the source backup from
-- which the new backup was copied.
--
-- 'sourceRegion', 'destinationBackup_sourceRegion' - The AWS region that contains the source backup from which the new backup
-- was copied.
newDestinationBackup ::
  DestinationBackup
newDestinationBackup :: DestinationBackup
newDestinationBackup =
  DestinationBackup'
    { $sel:createTimestamp:DestinationBackup' :: Maybe POSIX
createTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sourceBackup:DestinationBackup' :: Maybe Text
sourceBackup = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceCluster:DestinationBackup' :: Maybe Text
sourceCluster = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceRegion:DestinationBackup' :: Maybe Text
sourceRegion = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time when both the source backup was created.
destinationBackup_createTimestamp :: Lens.Lens' DestinationBackup (Prelude.Maybe Prelude.UTCTime)
destinationBackup_createTimestamp :: Lens' DestinationBackup (Maybe UTCTime)
destinationBackup_createTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationBackup' {Maybe POSIX
createTimestamp :: Maybe POSIX
$sel:createTimestamp:DestinationBackup' :: DestinationBackup -> Maybe POSIX
createTimestamp} -> Maybe POSIX
createTimestamp) (\s :: DestinationBackup
s@DestinationBackup' {} Maybe POSIX
a -> DestinationBackup
s {$sel:createTimestamp:DestinationBackup' :: Maybe POSIX
createTimestamp = Maybe POSIX
a} :: DestinationBackup) 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 identifier (ID) of the source backup from which the new backup was
-- copied.
destinationBackup_sourceBackup :: Lens.Lens' DestinationBackup (Prelude.Maybe Prelude.Text)
destinationBackup_sourceBackup :: Lens' DestinationBackup (Maybe Text)
destinationBackup_sourceBackup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationBackup' {Maybe Text
sourceBackup :: Maybe Text
$sel:sourceBackup:DestinationBackup' :: DestinationBackup -> Maybe Text
sourceBackup} -> Maybe Text
sourceBackup) (\s :: DestinationBackup
s@DestinationBackup' {} Maybe Text
a -> DestinationBackup
s {$sel:sourceBackup:DestinationBackup' :: Maybe Text
sourceBackup = Maybe Text
a} :: DestinationBackup)

-- | The identifier (ID) of the cluster containing the source backup from
-- which the new backup was copied.
destinationBackup_sourceCluster :: Lens.Lens' DestinationBackup (Prelude.Maybe Prelude.Text)
destinationBackup_sourceCluster :: Lens' DestinationBackup (Maybe Text)
destinationBackup_sourceCluster = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationBackup' {Maybe Text
sourceCluster :: Maybe Text
$sel:sourceCluster:DestinationBackup' :: DestinationBackup -> Maybe Text
sourceCluster} -> Maybe Text
sourceCluster) (\s :: DestinationBackup
s@DestinationBackup' {} Maybe Text
a -> DestinationBackup
s {$sel:sourceCluster:DestinationBackup' :: Maybe Text
sourceCluster = Maybe Text
a} :: DestinationBackup)

-- | The AWS region that contains the source backup from which the new backup
-- was copied.
destinationBackup_sourceRegion :: Lens.Lens' DestinationBackup (Prelude.Maybe Prelude.Text)
destinationBackup_sourceRegion :: Lens' DestinationBackup (Maybe Text)
destinationBackup_sourceRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationBackup' {Maybe Text
sourceRegion :: Maybe Text
$sel:sourceRegion:DestinationBackup' :: DestinationBackup -> Maybe Text
sourceRegion} -> Maybe Text
sourceRegion) (\s :: DestinationBackup
s@DestinationBackup' {} Maybe Text
a -> DestinationBackup
s {$sel:sourceRegion:DestinationBackup' :: Maybe Text
sourceRegion = Maybe Text
a} :: DestinationBackup)

instance Data.FromJSON DestinationBackup where
  parseJSON :: Value -> Parser DestinationBackup
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DestinationBackup"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text -> Maybe Text -> Maybe Text -> DestinationBackup
DestinationBackup'
            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
"CreateTimestamp")
            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
"SourceBackup")
            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
"SourceCluster")
            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
"SourceRegion")
      )

instance Prelude.Hashable DestinationBackup where
  hashWithSalt :: Int -> DestinationBackup -> Int
hashWithSalt Int
_salt DestinationBackup' {Maybe Text
Maybe POSIX
sourceRegion :: Maybe Text
sourceCluster :: Maybe Text
sourceBackup :: Maybe Text
createTimestamp :: Maybe POSIX
$sel:sourceRegion:DestinationBackup' :: DestinationBackup -> Maybe Text
$sel:sourceCluster:DestinationBackup' :: DestinationBackup -> Maybe Text
$sel:sourceBackup:DestinationBackup' :: DestinationBackup -> Maybe Text
$sel:createTimestamp:DestinationBackup' :: DestinationBackup -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceBackup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceCluster
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceRegion

instance Prelude.NFData DestinationBackup where
  rnf :: DestinationBackup -> ()
rnf DestinationBackup' {Maybe Text
Maybe POSIX
sourceRegion :: Maybe Text
sourceCluster :: Maybe Text
sourceBackup :: Maybe Text
createTimestamp :: Maybe POSIX
$sel:sourceRegion:DestinationBackup' :: DestinationBackup -> Maybe Text
$sel:sourceCluster:DestinationBackup' :: DestinationBackup -> Maybe Text
$sel:sourceBackup:DestinationBackup' :: DestinationBackup -> Maybe Text
$sel:createTimestamp:DestinationBackup' :: DestinationBackup -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceBackup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceCluster
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceRegion