{-# 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.Neptune.Types.UpgradeTarget
-- 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.Neptune.Types.UpgradeTarget where

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

-- | The version of the database engine that a DB instance can be upgraded
-- to.
--
-- /See:/ 'newUpgradeTarget' smart constructor.
data UpgradeTarget = UpgradeTarget'
  { -- | The version number of the upgrade target database engine.
    UpgradeTarget -> Maybe Text
engineVersion :: Prelude.Maybe Prelude.Text,
    -- | A value that indicates whether a database engine is upgraded to a major
    -- version.
    UpgradeTarget -> Maybe Bool
isMajorVersionUpgrade :: Prelude.Maybe Prelude.Bool,
    -- | The name of the upgrade target database engine.
    UpgradeTarget -> Maybe Text
engine :: Prelude.Maybe Prelude.Text,
    -- | A value that indicates whether the target version is applied to any
    -- source DB instances that have AutoMinorVersionUpgrade set to true.
    UpgradeTarget -> Maybe Bool
autoUpgrade :: Prelude.Maybe Prelude.Bool,
    -- | The version of the database engine that a DB instance can be upgraded
    -- to.
    UpgradeTarget -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (UpgradeTarget -> UpgradeTarget -> Bool
(UpgradeTarget -> UpgradeTarget -> Bool)
-> (UpgradeTarget -> UpgradeTarget -> Bool) -> Eq UpgradeTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpgradeTarget -> UpgradeTarget -> Bool
$c/= :: UpgradeTarget -> UpgradeTarget -> Bool
== :: UpgradeTarget -> UpgradeTarget -> Bool
$c== :: UpgradeTarget -> UpgradeTarget -> Bool
Prelude.Eq, ReadPrec [UpgradeTarget]
ReadPrec UpgradeTarget
Int -> ReadS UpgradeTarget
ReadS [UpgradeTarget]
(Int -> ReadS UpgradeTarget)
-> ReadS [UpgradeTarget]
-> ReadPrec UpgradeTarget
-> ReadPrec [UpgradeTarget]
-> Read UpgradeTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpgradeTarget]
$creadListPrec :: ReadPrec [UpgradeTarget]
readPrec :: ReadPrec UpgradeTarget
$creadPrec :: ReadPrec UpgradeTarget
readList :: ReadS [UpgradeTarget]
$creadList :: ReadS [UpgradeTarget]
readsPrec :: Int -> ReadS UpgradeTarget
$creadsPrec :: Int -> ReadS UpgradeTarget
Prelude.Read, Int -> UpgradeTarget -> ShowS
[UpgradeTarget] -> ShowS
UpgradeTarget -> String
(Int -> UpgradeTarget -> ShowS)
-> (UpgradeTarget -> String)
-> ([UpgradeTarget] -> ShowS)
-> Show UpgradeTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpgradeTarget] -> ShowS
$cshowList :: [UpgradeTarget] -> ShowS
show :: UpgradeTarget -> String
$cshow :: UpgradeTarget -> String
showsPrec :: Int -> UpgradeTarget -> ShowS
$cshowsPrec :: Int -> UpgradeTarget -> ShowS
Prelude.Show, (forall x. UpgradeTarget -> Rep UpgradeTarget x)
-> (forall x. Rep UpgradeTarget x -> UpgradeTarget)
-> Generic UpgradeTarget
forall x. Rep UpgradeTarget x -> UpgradeTarget
forall x. UpgradeTarget -> Rep UpgradeTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpgradeTarget x -> UpgradeTarget
$cfrom :: forall x. UpgradeTarget -> Rep UpgradeTarget x
Prelude.Generic)

-- |
-- Create a value of 'UpgradeTarget' 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:
--
-- 'engineVersion', 'upgradeTarget_engineVersion' - The version number of the upgrade target database engine.
--
-- 'isMajorVersionUpgrade', 'upgradeTarget_isMajorVersionUpgrade' - A value that indicates whether a database engine is upgraded to a major
-- version.
--
-- 'engine', 'upgradeTarget_engine' - The name of the upgrade target database engine.
--
-- 'autoUpgrade', 'upgradeTarget_autoUpgrade' - A value that indicates whether the target version is applied to any
-- source DB instances that have AutoMinorVersionUpgrade set to true.
--
-- 'description', 'upgradeTarget_description' - The version of the database engine that a DB instance can be upgraded
-- to.
newUpgradeTarget ::
  UpgradeTarget
newUpgradeTarget :: UpgradeTarget
newUpgradeTarget =
  UpgradeTarget' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> UpgradeTarget
UpgradeTarget'
    { $sel:engineVersion:UpgradeTarget' :: Maybe Text
engineVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isMajorVersionUpgrade:UpgradeTarget' :: Maybe Bool
isMajorVersionUpgrade = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:engine:UpgradeTarget' :: Maybe Text
engine = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:autoUpgrade:UpgradeTarget' :: Maybe Bool
autoUpgrade = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpgradeTarget' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The version number of the upgrade target database engine.
upgradeTarget_engineVersion :: Lens.Lens' UpgradeTarget (Prelude.Maybe Prelude.Text)
upgradeTarget_engineVersion :: (Maybe Text -> f (Maybe Text)) -> UpgradeTarget -> f UpgradeTarget
upgradeTarget_engineVersion = (UpgradeTarget -> Maybe Text)
-> (UpgradeTarget -> Maybe Text -> UpgradeTarget)
-> Lens UpgradeTarget UpgradeTarget (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeTarget' {Maybe Text
engineVersion :: Maybe Text
$sel:engineVersion:UpgradeTarget' :: UpgradeTarget -> Maybe Text
engineVersion} -> Maybe Text
engineVersion) (\s :: UpgradeTarget
s@UpgradeTarget' {} Maybe Text
a -> UpgradeTarget
s {$sel:engineVersion:UpgradeTarget' :: Maybe Text
engineVersion = Maybe Text
a} :: UpgradeTarget)

-- | A value that indicates whether a database engine is upgraded to a major
-- version.
upgradeTarget_isMajorVersionUpgrade :: Lens.Lens' UpgradeTarget (Prelude.Maybe Prelude.Bool)
upgradeTarget_isMajorVersionUpgrade :: (Maybe Bool -> f (Maybe Bool)) -> UpgradeTarget -> f UpgradeTarget
upgradeTarget_isMajorVersionUpgrade = (UpgradeTarget -> Maybe Bool)
-> (UpgradeTarget -> Maybe Bool -> UpgradeTarget)
-> Lens UpgradeTarget UpgradeTarget (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeTarget' {Maybe Bool
isMajorVersionUpgrade :: Maybe Bool
$sel:isMajorVersionUpgrade:UpgradeTarget' :: UpgradeTarget -> Maybe Bool
isMajorVersionUpgrade} -> Maybe Bool
isMajorVersionUpgrade) (\s :: UpgradeTarget
s@UpgradeTarget' {} Maybe Bool
a -> UpgradeTarget
s {$sel:isMajorVersionUpgrade:UpgradeTarget' :: Maybe Bool
isMajorVersionUpgrade = Maybe Bool
a} :: UpgradeTarget)

-- | The name of the upgrade target database engine.
upgradeTarget_engine :: Lens.Lens' UpgradeTarget (Prelude.Maybe Prelude.Text)
upgradeTarget_engine :: (Maybe Text -> f (Maybe Text)) -> UpgradeTarget -> f UpgradeTarget
upgradeTarget_engine = (UpgradeTarget -> Maybe Text)
-> (UpgradeTarget -> Maybe Text -> UpgradeTarget)
-> Lens UpgradeTarget UpgradeTarget (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeTarget' {Maybe Text
engine :: Maybe Text
$sel:engine:UpgradeTarget' :: UpgradeTarget -> Maybe Text
engine} -> Maybe Text
engine) (\s :: UpgradeTarget
s@UpgradeTarget' {} Maybe Text
a -> UpgradeTarget
s {$sel:engine:UpgradeTarget' :: Maybe Text
engine = Maybe Text
a} :: UpgradeTarget)

-- | A value that indicates whether the target version is applied to any
-- source DB instances that have AutoMinorVersionUpgrade set to true.
upgradeTarget_autoUpgrade :: Lens.Lens' UpgradeTarget (Prelude.Maybe Prelude.Bool)
upgradeTarget_autoUpgrade :: (Maybe Bool -> f (Maybe Bool)) -> UpgradeTarget -> f UpgradeTarget
upgradeTarget_autoUpgrade = (UpgradeTarget -> Maybe Bool)
-> (UpgradeTarget -> Maybe Bool -> UpgradeTarget)
-> Lens UpgradeTarget UpgradeTarget (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeTarget' {Maybe Bool
autoUpgrade :: Maybe Bool
$sel:autoUpgrade:UpgradeTarget' :: UpgradeTarget -> Maybe Bool
autoUpgrade} -> Maybe Bool
autoUpgrade) (\s :: UpgradeTarget
s@UpgradeTarget' {} Maybe Bool
a -> UpgradeTarget
s {$sel:autoUpgrade:UpgradeTarget' :: Maybe Bool
autoUpgrade = Maybe Bool
a} :: UpgradeTarget)

-- | The version of the database engine that a DB instance can be upgraded
-- to.
upgradeTarget_description :: Lens.Lens' UpgradeTarget (Prelude.Maybe Prelude.Text)
upgradeTarget_description :: (Maybe Text -> f (Maybe Text)) -> UpgradeTarget -> f UpgradeTarget
upgradeTarget_description = (UpgradeTarget -> Maybe Text)
-> (UpgradeTarget -> Maybe Text -> UpgradeTarget)
-> Lens UpgradeTarget UpgradeTarget (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpgradeTarget' {Maybe Text
description :: Maybe Text
$sel:description:UpgradeTarget' :: UpgradeTarget -> Maybe Text
description} -> Maybe Text
description) (\s :: UpgradeTarget
s@UpgradeTarget' {} Maybe Text
a -> UpgradeTarget
s {$sel:description:UpgradeTarget' :: Maybe Text
description = Maybe Text
a} :: UpgradeTarget)

instance Core.FromXML UpgradeTarget where
  parseXML :: [Node] -> Either String UpgradeTarget
parseXML [Node]
x =
    Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> UpgradeTarget
UpgradeTarget'
      (Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> UpgradeTarget)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Text -> Maybe Bool -> Maybe Text -> UpgradeTarget)
forall (f :: * -> *) a b. Functor 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
"EngineVersion")
      Either
  String
  (Maybe Bool
   -> Maybe Text -> Maybe Bool -> Maybe Text -> UpgradeTarget)
-> Either String (Maybe Bool)
-> Either
     String (Maybe Text -> Maybe Bool -> Maybe Text -> UpgradeTarget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsMajorVersionUpgrade")
      Either
  String (Maybe Text -> Maybe Bool -> Maybe Text -> UpgradeTarget)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Maybe Text -> UpgradeTarget)
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
"Engine")
      Either String (Maybe Bool -> Maybe Text -> UpgradeTarget)
-> Either String (Maybe Bool)
-> Either String (Maybe Text -> UpgradeTarget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AutoUpgrade")
      Either String (Maybe Text -> UpgradeTarget)
-> Either String (Maybe Text) -> Either String UpgradeTarget
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 UpgradeTarget

instance Prelude.NFData UpgradeTarget