{-# 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.RDS.Types.DBClusterBacktrack
-- 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.RDS.Types.DBClusterBacktrack 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

-- | This data type is used as a response element in the
-- @DescribeDBClusterBacktracks@ action.
--
-- /See:/ 'newDBClusterBacktrack' smart constructor.
data DBClusterBacktrack = DBClusterBacktrack'
  { -- | Contains the backtrack identifier.
    DBClusterBacktrack -> Maybe Text
backtrackIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of the time at which the backtrack was requested.
    DBClusterBacktrack -> Maybe ISO8601
backtrackRequestCreationTime :: Prelude.Maybe Data.ISO8601,
    -- | The timestamp of the time to which the DB cluster was backtracked.
    DBClusterBacktrack -> Maybe ISO8601
backtrackTo :: Prelude.Maybe Data.ISO8601,
    -- | The timestamp of the time from which the DB cluster was backtracked.
    DBClusterBacktrack -> Maybe ISO8601
backtrackedFrom :: Prelude.Maybe Data.ISO8601,
    -- | Contains a user-supplied DB cluster identifier. This identifier is the
    -- unique key that identifies a DB cluster.
    DBClusterBacktrack -> Maybe Text
dbClusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The status of the backtrack. This property returns one of the following
    -- values:
    --
    -- -   @applying@ - The backtrack is currently being applied to or rolled
    --     back from the DB cluster.
    --
    -- -   @completed@ - The backtrack has successfully been applied to or
    --     rolled back from the DB cluster.
    --
    -- -   @failed@ - An error occurred while the backtrack was applied to or
    --     rolled back from the DB cluster.
    --
    -- -   @pending@ - The backtrack is currently pending application to or
    --     rollback from the DB cluster.
    DBClusterBacktrack -> Maybe Text
status :: Prelude.Maybe Prelude.Text
  }
  deriving (DBClusterBacktrack -> DBClusterBacktrack -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DBClusterBacktrack -> DBClusterBacktrack -> Bool
$c/= :: DBClusterBacktrack -> DBClusterBacktrack -> Bool
== :: DBClusterBacktrack -> DBClusterBacktrack -> Bool
$c== :: DBClusterBacktrack -> DBClusterBacktrack -> Bool
Prelude.Eq, ReadPrec [DBClusterBacktrack]
ReadPrec DBClusterBacktrack
Int -> ReadS DBClusterBacktrack
ReadS [DBClusterBacktrack]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DBClusterBacktrack]
$creadListPrec :: ReadPrec [DBClusterBacktrack]
readPrec :: ReadPrec DBClusterBacktrack
$creadPrec :: ReadPrec DBClusterBacktrack
readList :: ReadS [DBClusterBacktrack]
$creadList :: ReadS [DBClusterBacktrack]
readsPrec :: Int -> ReadS DBClusterBacktrack
$creadsPrec :: Int -> ReadS DBClusterBacktrack
Prelude.Read, Int -> DBClusterBacktrack -> ShowS
[DBClusterBacktrack] -> ShowS
DBClusterBacktrack -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DBClusterBacktrack] -> ShowS
$cshowList :: [DBClusterBacktrack] -> ShowS
show :: DBClusterBacktrack -> String
$cshow :: DBClusterBacktrack -> String
showsPrec :: Int -> DBClusterBacktrack -> ShowS
$cshowsPrec :: Int -> DBClusterBacktrack -> ShowS
Prelude.Show, forall x. Rep DBClusterBacktrack x -> DBClusterBacktrack
forall x. DBClusterBacktrack -> Rep DBClusterBacktrack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DBClusterBacktrack x -> DBClusterBacktrack
$cfrom :: forall x. DBClusterBacktrack -> Rep DBClusterBacktrack x
Prelude.Generic)

-- |
-- Create a value of 'DBClusterBacktrack' 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:
--
-- 'backtrackIdentifier', 'dbClusterBacktrack_backtrackIdentifier' - Contains the backtrack identifier.
--
-- 'backtrackRequestCreationTime', 'dbClusterBacktrack_backtrackRequestCreationTime' - The timestamp of the time at which the backtrack was requested.
--
-- 'backtrackTo', 'dbClusterBacktrack_backtrackTo' - The timestamp of the time to which the DB cluster was backtracked.
--
-- 'backtrackedFrom', 'dbClusterBacktrack_backtrackedFrom' - The timestamp of the time from which the DB cluster was backtracked.
--
-- 'dbClusterIdentifier', 'dbClusterBacktrack_dbClusterIdentifier' - Contains a user-supplied DB cluster identifier. This identifier is the
-- unique key that identifies a DB cluster.
--
-- 'status', 'dbClusterBacktrack_status' - The status of the backtrack. This property returns one of the following
-- values:
--
-- -   @applying@ - The backtrack is currently being applied to or rolled
--     back from the DB cluster.
--
-- -   @completed@ - The backtrack has successfully been applied to or
--     rolled back from the DB cluster.
--
-- -   @failed@ - An error occurred while the backtrack was applied to or
--     rolled back from the DB cluster.
--
-- -   @pending@ - The backtrack is currently pending application to or
--     rollback from the DB cluster.
newDBClusterBacktrack ::
  DBClusterBacktrack
newDBClusterBacktrack :: DBClusterBacktrack
newDBClusterBacktrack =
  DBClusterBacktrack'
    { $sel:backtrackIdentifier:DBClusterBacktrack' :: Maybe Text
backtrackIdentifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:backtrackRequestCreationTime:DBClusterBacktrack' :: Maybe ISO8601
backtrackRequestCreationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:backtrackTo:DBClusterBacktrack' :: Maybe ISO8601
backtrackTo = forall a. Maybe a
Prelude.Nothing,
      $sel:backtrackedFrom:DBClusterBacktrack' :: Maybe ISO8601
backtrackedFrom = forall a. Maybe a
Prelude.Nothing,
      $sel:dbClusterIdentifier:DBClusterBacktrack' :: Maybe Text
dbClusterIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DBClusterBacktrack' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Contains the backtrack identifier.
dbClusterBacktrack_backtrackIdentifier :: Lens.Lens' DBClusterBacktrack (Prelude.Maybe Prelude.Text)
dbClusterBacktrack_backtrackIdentifier :: Lens' DBClusterBacktrack (Maybe Text)
dbClusterBacktrack_backtrackIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterBacktrack' {Maybe Text
backtrackIdentifier :: Maybe Text
$sel:backtrackIdentifier:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
backtrackIdentifier} -> Maybe Text
backtrackIdentifier) (\s :: DBClusterBacktrack
s@DBClusterBacktrack' {} Maybe Text
a -> DBClusterBacktrack
s {$sel:backtrackIdentifier:DBClusterBacktrack' :: Maybe Text
backtrackIdentifier = Maybe Text
a} :: DBClusterBacktrack)

-- | The timestamp of the time at which the backtrack was requested.
dbClusterBacktrack_backtrackRequestCreationTime :: Lens.Lens' DBClusterBacktrack (Prelude.Maybe Prelude.UTCTime)
dbClusterBacktrack_backtrackRequestCreationTime :: Lens' DBClusterBacktrack (Maybe UTCTime)
dbClusterBacktrack_backtrackRequestCreationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterBacktrack' {Maybe ISO8601
backtrackRequestCreationTime :: Maybe ISO8601
$sel:backtrackRequestCreationTime:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
backtrackRequestCreationTime} -> Maybe ISO8601
backtrackRequestCreationTime) (\s :: DBClusterBacktrack
s@DBClusterBacktrack' {} Maybe ISO8601
a -> DBClusterBacktrack
s {$sel:backtrackRequestCreationTime:DBClusterBacktrack' :: Maybe ISO8601
backtrackRequestCreationTime = Maybe ISO8601
a} :: DBClusterBacktrack) 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 timestamp of the time to which the DB cluster was backtracked.
dbClusterBacktrack_backtrackTo :: Lens.Lens' DBClusterBacktrack (Prelude.Maybe Prelude.UTCTime)
dbClusterBacktrack_backtrackTo :: Lens' DBClusterBacktrack (Maybe UTCTime)
dbClusterBacktrack_backtrackTo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterBacktrack' {Maybe ISO8601
backtrackTo :: Maybe ISO8601
$sel:backtrackTo:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
backtrackTo} -> Maybe ISO8601
backtrackTo) (\s :: DBClusterBacktrack
s@DBClusterBacktrack' {} Maybe ISO8601
a -> DBClusterBacktrack
s {$sel:backtrackTo:DBClusterBacktrack' :: Maybe ISO8601
backtrackTo = Maybe ISO8601
a} :: DBClusterBacktrack) 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 timestamp of the time from which the DB cluster was backtracked.
dbClusterBacktrack_backtrackedFrom :: Lens.Lens' DBClusterBacktrack (Prelude.Maybe Prelude.UTCTime)
dbClusterBacktrack_backtrackedFrom :: Lens' DBClusterBacktrack (Maybe UTCTime)
dbClusterBacktrack_backtrackedFrom = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterBacktrack' {Maybe ISO8601
backtrackedFrom :: Maybe ISO8601
$sel:backtrackedFrom:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
backtrackedFrom} -> Maybe ISO8601
backtrackedFrom) (\s :: DBClusterBacktrack
s@DBClusterBacktrack' {} Maybe ISO8601
a -> DBClusterBacktrack
s {$sel:backtrackedFrom:DBClusterBacktrack' :: Maybe ISO8601
backtrackedFrom = Maybe ISO8601
a} :: DBClusterBacktrack) 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

-- | Contains a user-supplied DB cluster identifier. This identifier is the
-- unique key that identifies a DB cluster.
dbClusterBacktrack_dbClusterIdentifier :: Lens.Lens' DBClusterBacktrack (Prelude.Maybe Prelude.Text)
dbClusterBacktrack_dbClusterIdentifier :: Lens' DBClusterBacktrack (Maybe Text)
dbClusterBacktrack_dbClusterIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterBacktrack' {Maybe Text
dbClusterIdentifier :: Maybe Text
$sel:dbClusterIdentifier:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
dbClusterIdentifier} -> Maybe Text
dbClusterIdentifier) (\s :: DBClusterBacktrack
s@DBClusterBacktrack' {} Maybe Text
a -> DBClusterBacktrack
s {$sel:dbClusterIdentifier:DBClusterBacktrack' :: Maybe Text
dbClusterIdentifier = Maybe Text
a} :: DBClusterBacktrack)

-- | The status of the backtrack. This property returns one of the following
-- values:
--
-- -   @applying@ - The backtrack is currently being applied to or rolled
--     back from the DB cluster.
--
-- -   @completed@ - The backtrack has successfully been applied to or
--     rolled back from the DB cluster.
--
-- -   @failed@ - An error occurred while the backtrack was applied to or
--     rolled back from the DB cluster.
--
-- -   @pending@ - The backtrack is currently pending application to or
--     rollback from the DB cluster.
dbClusterBacktrack_status :: Lens.Lens' DBClusterBacktrack (Prelude.Maybe Prelude.Text)
dbClusterBacktrack_status :: Lens' DBClusterBacktrack (Maybe Text)
dbClusterBacktrack_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterBacktrack' {Maybe Text
status :: Maybe Text
$sel:status:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
status} -> Maybe Text
status) (\s :: DBClusterBacktrack
s@DBClusterBacktrack' {} Maybe Text
a -> DBClusterBacktrack
s {$sel:status:DBClusterBacktrack' :: Maybe Text
status = Maybe Text
a} :: DBClusterBacktrack)

instance Data.FromXML DBClusterBacktrack where
  parseXML :: [Node] -> Either String DBClusterBacktrack
parseXML [Node]
x =
    Maybe Text
-> Maybe ISO8601
-> Maybe ISO8601
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> DBClusterBacktrack
DBClusterBacktrack'
      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
"BacktrackIdentifier")
      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
"BacktrackRequestCreationTime")
      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
"BacktrackTo")
      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
"BacktrackedFrom")
      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
"DBClusterIdentifier")
      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
"Status")

instance Prelude.Hashable DBClusterBacktrack where
  hashWithSalt :: Int -> DBClusterBacktrack -> Int
hashWithSalt Int
_salt DBClusterBacktrack' {Maybe Text
Maybe ISO8601
status :: Maybe Text
dbClusterIdentifier :: Maybe Text
backtrackedFrom :: Maybe ISO8601
backtrackTo :: Maybe ISO8601
backtrackRequestCreationTime :: Maybe ISO8601
backtrackIdentifier :: Maybe Text
$sel:status:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
$sel:dbClusterIdentifier:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
$sel:backtrackedFrom:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
$sel:backtrackTo:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
$sel:backtrackRequestCreationTime:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
$sel:backtrackIdentifier:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
backtrackIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
backtrackRequestCreationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
backtrackTo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
backtrackedFrom
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbClusterIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData DBClusterBacktrack where
  rnf :: DBClusterBacktrack -> ()
rnf DBClusterBacktrack' {Maybe Text
Maybe ISO8601
status :: Maybe Text
dbClusterIdentifier :: Maybe Text
backtrackedFrom :: Maybe ISO8601
backtrackTo :: Maybe ISO8601
backtrackRequestCreationTime :: Maybe ISO8601
backtrackIdentifier :: Maybe Text
$sel:status:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
$sel:dbClusterIdentifier:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
$sel:backtrackedFrom:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
$sel:backtrackTo:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
$sel:backtrackRequestCreationTime:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe ISO8601
$sel:backtrackIdentifier:DBClusterBacktrack' :: DBClusterBacktrack -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
backtrackIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
backtrackRequestCreationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
backtrackTo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
backtrackedFrom
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbClusterIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status