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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal

-- | Describes a @RevisionTarget@.
--
-- /See:/ 'newRevisionTarget' smart constructor.
data RevisionTarget = RevisionTarget'
  { -- | The date on which the database revision was released.
    RevisionTarget -> Maybe ISO8601
databaseRevisionReleaseDate :: Prelude.Maybe Core.ISO8601,
    -- | 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,
    -- | 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
(RevisionTarget -> RevisionTarget -> Bool)
-> (RevisionTarget -> RevisionTarget -> Bool) -> Eq RevisionTarget
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]
(Int -> ReadS RevisionTarget)
-> ReadS [RevisionTarget]
-> ReadPrec RevisionTarget
-> ReadPrec [RevisionTarget]
-> Read 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
(Int -> RevisionTarget -> ShowS)
-> (RevisionTarget -> String)
-> ([RevisionTarget] -> ShowS)
-> Show RevisionTarget
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. RevisionTarget -> Rep RevisionTarget x)
-> (forall x. Rep RevisionTarget x -> RevisionTarget)
-> Generic RevisionTarget
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:
--
-- 'databaseRevisionReleaseDate', 'revisionTarget_databaseRevisionReleaseDate' - The date on which the database revision was released.
--
-- 'databaseRevision', 'revisionTarget_databaseRevision' - A unique string that identifies the version to update the cluster to.
-- You can use this value in ModifyClusterDbRevision.
--
-- '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' :: Maybe ISO8601 -> Maybe Text -> Maybe Text -> RevisionTarget
RevisionTarget'
    { $sel:databaseRevisionReleaseDate:RevisionTarget' :: Maybe ISO8601
databaseRevisionReleaseDate =
        Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:databaseRevision:RevisionTarget' :: Maybe Text
databaseRevision = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:RevisionTarget' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date on which the database revision was released.
revisionTarget_databaseRevisionReleaseDate :: Lens.Lens' RevisionTarget (Prelude.Maybe Prelude.UTCTime)
revisionTarget_databaseRevisionReleaseDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RevisionTarget -> f RevisionTarget
revisionTarget_databaseRevisionReleaseDate = (RevisionTarget -> Maybe ISO8601)
-> (RevisionTarget -> Maybe ISO8601 -> RevisionTarget)
-> Lens
     RevisionTarget RevisionTarget (Maybe ISO8601) (Maybe ISO8601)
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) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> RevisionTarget -> f RevisionTarget)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RevisionTarget
-> f RevisionTarget
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> RevisionTarget -> f RevisionTarget
revisionTarget_databaseRevision = (RevisionTarget -> Maybe Text)
-> (RevisionTarget -> Maybe Text -> RevisionTarget)
-> Lens RevisionTarget RevisionTarget (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> RevisionTarget -> f RevisionTarget
revisionTarget_description = (RevisionTarget -> Maybe Text)
-> (RevisionTarget -> Maybe Text -> RevisionTarget)
-> Lens RevisionTarget RevisionTarget (Maybe Text) (Maybe Text)
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 Core.FromXML RevisionTarget where
  parseXML :: [Node] -> Either String RevisionTarget
parseXML [Node]
x =
    Maybe ISO8601 -> Maybe Text -> Maybe Text -> RevisionTarget
RevisionTarget'
      (Maybe ISO8601 -> Maybe Text -> Maybe Text -> RevisionTarget)
-> Either String (Maybe ISO8601)
-> Either String (Maybe Text -> Maybe Text -> RevisionTarget)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DatabaseRevisionReleaseDate")
      Either String (Maybe Text -> Maybe Text -> RevisionTarget)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> RevisionTarget)
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
"DatabaseRevision")
      Either String (Maybe Text -> RevisionTarget)
-> Either String (Maybe Text) -> Either String RevisionTarget
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
"Description")

instance Prelude.Hashable RevisionTarget

instance Prelude.NFData RevisionTarget