{-# 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.RevisionTarget
-- 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.RevisionTarget 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

-- | Describes a @RevisionTarget@.
--
-- /See:/ 'newRevisionTarget' smart constructor.
data RevisionTarget = RevisionTarget'
  { -- | A unique string that identifies the version to update the cluster to.
    -- You can use this value in ModifyClusterDbRevision.
    RevisionTarget -> Maybe Text
databaseRevision :: Prelude.Maybe Prelude.Text,
    -- | The date on which the database revision was released.
    RevisionTarget -> Maybe ISO8601
databaseRevisionReleaseDate :: Prelude.Maybe Data.ISO8601,
    -- | A string that describes the changes and features that will be applied to
    -- the cluster when it is updated to the corresponding ClusterDbRevision.
    RevisionTarget -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (RevisionTarget -> RevisionTarget -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevisionTarget -> RevisionTarget -> Bool
$c/= :: RevisionTarget -> RevisionTarget -> Bool
== :: RevisionTarget -> RevisionTarget -> Bool
$c== :: RevisionTarget -> RevisionTarget -> Bool
Prelude.Eq, ReadPrec [RevisionTarget]
ReadPrec RevisionTarget
Int -> ReadS RevisionTarget
ReadS [RevisionTarget]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevisionTarget]
$creadListPrec :: ReadPrec [RevisionTarget]
readPrec :: ReadPrec RevisionTarget
$creadPrec :: ReadPrec RevisionTarget
readList :: ReadS [RevisionTarget]
$creadList :: ReadS [RevisionTarget]
readsPrec :: Int -> ReadS RevisionTarget
$creadsPrec :: Int -> ReadS RevisionTarget
Prelude.Read, Int -> RevisionTarget -> ShowS
[RevisionTarget] -> ShowS
RevisionTarget -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevisionTarget] -> ShowS
$cshowList :: [RevisionTarget] -> ShowS
show :: RevisionTarget -> String
$cshow :: RevisionTarget -> String
showsPrec :: Int -> RevisionTarget -> ShowS
$cshowsPrec :: Int -> RevisionTarget -> ShowS
Prelude.Show, forall x. Rep RevisionTarget x -> RevisionTarget
forall x. RevisionTarget -> Rep RevisionTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevisionTarget x -> RevisionTarget
$cfrom :: forall x. RevisionTarget -> Rep RevisionTarget x
Prelude.Generic)

-- |
-- Create a value of 'RevisionTarget' 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:
--
-- 'databaseRevision', 'revisionTarget_databaseRevision' - A unique string that identifies the version to update the cluster to.
-- You can use this value in ModifyClusterDbRevision.
--
-- 'databaseRevisionReleaseDate', 'revisionTarget_databaseRevisionReleaseDate' - The date on which the database revision was released.
--
-- 'description', 'revisionTarget_description' - A string that describes the changes and features that will be applied to
-- the cluster when it is updated to the corresponding ClusterDbRevision.
newRevisionTarget ::
  RevisionTarget
newRevisionTarget :: RevisionTarget
newRevisionTarget =
  RevisionTarget'
    { $sel:databaseRevision:RevisionTarget' :: Maybe Text
databaseRevision = forall a. Maybe a
Prelude.Nothing,
      $sel:databaseRevisionReleaseDate:RevisionTarget' :: Maybe ISO8601
databaseRevisionReleaseDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:RevisionTarget' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing
    }

-- | A unique string that identifies the version to update the cluster to.
-- You can use this value in ModifyClusterDbRevision.
revisionTarget_databaseRevision :: Lens.Lens' RevisionTarget (Prelude.Maybe Prelude.Text)
revisionTarget_databaseRevision :: Lens' RevisionTarget (Maybe Text)
revisionTarget_databaseRevision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionTarget' {Maybe Text
databaseRevision :: Maybe Text
$sel:databaseRevision:RevisionTarget' :: RevisionTarget -> Maybe Text
databaseRevision} -> Maybe Text
databaseRevision) (\s :: RevisionTarget
s@RevisionTarget' {} Maybe Text
a -> RevisionTarget
s {$sel:databaseRevision:RevisionTarget' :: Maybe Text
databaseRevision = Maybe Text
a} :: RevisionTarget)

-- | The date on which the database revision was released.
revisionTarget_databaseRevisionReleaseDate :: Lens.Lens' RevisionTarget (Prelude.Maybe Prelude.UTCTime)
revisionTarget_databaseRevisionReleaseDate :: Lens' RevisionTarget (Maybe UTCTime)
revisionTarget_databaseRevisionReleaseDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionTarget' {Maybe ISO8601
databaseRevisionReleaseDate :: Maybe ISO8601
$sel:databaseRevisionReleaseDate:RevisionTarget' :: RevisionTarget -> Maybe ISO8601
databaseRevisionReleaseDate} -> Maybe ISO8601
databaseRevisionReleaseDate) (\s :: RevisionTarget
s@RevisionTarget' {} Maybe ISO8601
a -> RevisionTarget
s {$sel:databaseRevisionReleaseDate:RevisionTarget' :: Maybe ISO8601
databaseRevisionReleaseDate = Maybe ISO8601
a} :: RevisionTarget) 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

-- | A string that describes the changes and features that will be applied to
-- the cluster when it is updated to the corresponding ClusterDbRevision.
revisionTarget_description :: Lens.Lens' RevisionTarget (Prelude.Maybe Prelude.Text)
revisionTarget_description :: Lens' RevisionTarget (Maybe Text)
revisionTarget_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionTarget' {Maybe Text
description :: Maybe Text
$sel:description:RevisionTarget' :: RevisionTarget -> Maybe Text
description} -> Maybe Text
description) (\s :: RevisionTarget
s@RevisionTarget' {} Maybe Text
a -> RevisionTarget
s {$sel:description:RevisionTarget' :: Maybe Text
description = Maybe Text
a} :: RevisionTarget)

instance Data.FromXML RevisionTarget where
  parseXML :: [Node] -> Either String RevisionTarget
parseXML [Node]
x =
    Maybe Text -> Maybe ISO8601 -> Maybe Text -> RevisionTarget
RevisionTarget'
      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
"DatabaseRevision")
      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
"DatabaseRevisionReleaseDate")
      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
"Description")

instance Prelude.Hashable RevisionTarget where
  hashWithSalt :: Int -> RevisionTarget -> Int
hashWithSalt Int
_salt RevisionTarget' {Maybe Text
Maybe ISO8601
description :: Maybe Text
databaseRevisionReleaseDate :: Maybe ISO8601
databaseRevision :: Maybe Text
$sel:description:RevisionTarget' :: RevisionTarget -> Maybe Text
$sel:databaseRevisionReleaseDate:RevisionTarget' :: RevisionTarget -> Maybe ISO8601
$sel:databaseRevision:RevisionTarget' :: RevisionTarget -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
databaseRevision
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
databaseRevisionReleaseDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description

instance Prelude.NFData RevisionTarget where
  rnf :: RevisionTarget -> ()
rnf RevisionTarget' {Maybe Text
Maybe ISO8601
description :: Maybe Text
databaseRevisionReleaseDate :: Maybe ISO8601
databaseRevision :: Maybe Text
$sel:description:RevisionTarget' :: RevisionTarget -> Maybe Text
$sel:databaseRevisionReleaseDate:RevisionTarget' :: RevisionTarget -> Maybe ISO8601
$sel:databaseRevision:RevisionTarget' :: RevisionTarget -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
databaseRevision
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
databaseRevisionReleaseDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description