{-# 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 #-}
module Amazonka.Redshift.Types.MaintenanceTrack where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal
import Amazonka.Redshift.Types.UpdateTarget
data MaintenanceTrack = MaintenanceTrack'
{
MaintenanceTrack -> Maybe Text
databaseVersion :: Prelude.Maybe Prelude.Text,
MaintenanceTrack -> Maybe Text
maintenanceTrackName :: Prelude.Maybe Prelude.Text,
MaintenanceTrack -> Maybe [UpdateTarget]
updateTargets :: Prelude.Maybe [UpdateTarget]
}
deriving (MaintenanceTrack -> MaintenanceTrack -> Bool
(MaintenanceTrack -> MaintenanceTrack -> Bool)
-> (MaintenanceTrack -> MaintenanceTrack -> Bool)
-> Eq MaintenanceTrack
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MaintenanceTrack -> MaintenanceTrack -> Bool
$c/= :: MaintenanceTrack -> MaintenanceTrack -> Bool
== :: MaintenanceTrack -> MaintenanceTrack -> Bool
$c== :: MaintenanceTrack -> MaintenanceTrack -> Bool
Prelude.Eq, ReadPrec [MaintenanceTrack]
ReadPrec MaintenanceTrack
Int -> ReadS MaintenanceTrack
ReadS [MaintenanceTrack]
(Int -> ReadS MaintenanceTrack)
-> ReadS [MaintenanceTrack]
-> ReadPrec MaintenanceTrack
-> ReadPrec [MaintenanceTrack]
-> Read MaintenanceTrack
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MaintenanceTrack]
$creadListPrec :: ReadPrec [MaintenanceTrack]
readPrec :: ReadPrec MaintenanceTrack
$creadPrec :: ReadPrec MaintenanceTrack
readList :: ReadS [MaintenanceTrack]
$creadList :: ReadS [MaintenanceTrack]
readsPrec :: Int -> ReadS MaintenanceTrack
$creadsPrec :: Int -> ReadS MaintenanceTrack
Prelude.Read, Int -> MaintenanceTrack -> ShowS
[MaintenanceTrack] -> ShowS
MaintenanceTrack -> String
(Int -> MaintenanceTrack -> ShowS)
-> (MaintenanceTrack -> String)
-> ([MaintenanceTrack] -> ShowS)
-> Show MaintenanceTrack
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MaintenanceTrack] -> ShowS
$cshowList :: [MaintenanceTrack] -> ShowS
show :: MaintenanceTrack -> String
$cshow :: MaintenanceTrack -> String
showsPrec :: Int -> MaintenanceTrack -> ShowS
$cshowsPrec :: Int -> MaintenanceTrack -> ShowS
Prelude.Show, (forall x. MaintenanceTrack -> Rep MaintenanceTrack x)
-> (forall x. Rep MaintenanceTrack x -> MaintenanceTrack)
-> Generic MaintenanceTrack
forall x. Rep MaintenanceTrack x -> MaintenanceTrack
forall x. MaintenanceTrack -> Rep MaintenanceTrack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MaintenanceTrack x -> MaintenanceTrack
$cfrom :: forall x. MaintenanceTrack -> Rep MaintenanceTrack x
Prelude.Generic)
newMaintenanceTrack ::
MaintenanceTrack
newMaintenanceTrack :: MaintenanceTrack
newMaintenanceTrack =
MaintenanceTrack' :: Maybe Text
-> Maybe Text -> Maybe [UpdateTarget] -> MaintenanceTrack
MaintenanceTrack'
{ $sel:databaseVersion:MaintenanceTrack' :: Maybe Text
databaseVersion =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maintenanceTrackName:MaintenanceTrack' :: Maybe Text
maintenanceTrackName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:updateTargets:MaintenanceTrack' :: Maybe [UpdateTarget]
updateTargets = Maybe [UpdateTarget]
forall a. Maybe a
Prelude.Nothing
}
maintenanceTrack_databaseVersion :: Lens.Lens' MaintenanceTrack (Prelude.Maybe Prelude.Text)
maintenanceTrack_databaseVersion :: (Maybe Text -> f (Maybe Text))
-> MaintenanceTrack -> f MaintenanceTrack
maintenanceTrack_databaseVersion = (MaintenanceTrack -> Maybe Text)
-> (MaintenanceTrack -> Maybe Text -> MaintenanceTrack)
-> Lens MaintenanceTrack MaintenanceTrack (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceTrack' {Maybe Text
databaseVersion :: Maybe Text
$sel:databaseVersion:MaintenanceTrack' :: MaintenanceTrack -> Maybe Text
databaseVersion} -> Maybe Text
databaseVersion) (\s :: MaintenanceTrack
s@MaintenanceTrack' {} Maybe Text
a -> MaintenanceTrack
s {$sel:databaseVersion:MaintenanceTrack' :: Maybe Text
databaseVersion = Maybe Text
a} :: MaintenanceTrack)
maintenanceTrack_maintenanceTrackName :: Lens.Lens' MaintenanceTrack (Prelude.Maybe Prelude.Text)
maintenanceTrack_maintenanceTrackName :: (Maybe Text -> f (Maybe Text))
-> MaintenanceTrack -> f MaintenanceTrack
maintenanceTrack_maintenanceTrackName = (MaintenanceTrack -> Maybe Text)
-> (MaintenanceTrack -> Maybe Text -> MaintenanceTrack)
-> Lens MaintenanceTrack MaintenanceTrack (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceTrack' {Maybe Text
maintenanceTrackName :: Maybe Text
$sel:maintenanceTrackName:MaintenanceTrack' :: MaintenanceTrack -> Maybe Text
maintenanceTrackName} -> Maybe Text
maintenanceTrackName) (\s :: MaintenanceTrack
s@MaintenanceTrack' {} Maybe Text
a -> MaintenanceTrack
s {$sel:maintenanceTrackName:MaintenanceTrack' :: Maybe Text
maintenanceTrackName = Maybe Text
a} :: MaintenanceTrack)
maintenanceTrack_updateTargets :: Lens.Lens' MaintenanceTrack (Prelude.Maybe [UpdateTarget])
maintenanceTrack_updateTargets :: (Maybe [UpdateTarget] -> f (Maybe [UpdateTarget]))
-> MaintenanceTrack -> f MaintenanceTrack
maintenanceTrack_updateTargets = (MaintenanceTrack -> Maybe [UpdateTarget])
-> (MaintenanceTrack -> Maybe [UpdateTarget] -> MaintenanceTrack)
-> Lens
MaintenanceTrack
MaintenanceTrack
(Maybe [UpdateTarget])
(Maybe [UpdateTarget])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceTrack' {Maybe [UpdateTarget]
updateTargets :: Maybe [UpdateTarget]
$sel:updateTargets:MaintenanceTrack' :: MaintenanceTrack -> Maybe [UpdateTarget]
updateTargets} -> Maybe [UpdateTarget]
updateTargets) (\s :: MaintenanceTrack
s@MaintenanceTrack' {} Maybe [UpdateTarget]
a -> MaintenanceTrack
s {$sel:updateTargets:MaintenanceTrack' :: Maybe [UpdateTarget]
updateTargets = Maybe [UpdateTarget]
a} :: MaintenanceTrack) ((Maybe [UpdateTarget] -> f (Maybe [UpdateTarget]))
-> MaintenanceTrack -> f MaintenanceTrack)
-> ((Maybe [UpdateTarget] -> f (Maybe [UpdateTarget]))
-> Maybe [UpdateTarget] -> f (Maybe [UpdateTarget]))
-> (Maybe [UpdateTarget] -> f (Maybe [UpdateTarget]))
-> MaintenanceTrack
-> f MaintenanceTrack
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [UpdateTarget] [UpdateTarget] [UpdateTarget] [UpdateTarget]
-> Iso
(Maybe [UpdateTarget])
(Maybe [UpdateTarget])
(Maybe [UpdateTarget])
(Maybe [UpdateTarget])
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 [UpdateTarget] [UpdateTarget] [UpdateTarget] [UpdateTarget]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromXML MaintenanceTrack where
parseXML :: [Node] -> Either String MaintenanceTrack
parseXML [Node]
x =
Maybe Text
-> Maybe Text -> Maybe [UpdateTarget] -> MaintenanceTrack
MaintenanceTrack'
(Maybe Text
-> Maybe Text -> Maybe [UpdateTarget] -> MaintenanceTrack)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe [UpdateTarget] -> MaintenanceTrack)
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
"DatabaseVersion")
Either
String (Maybe Text -> Maybe [UpdateTarget] -> MaintenanceTrack)
-> Either String (Maybe Text)
-> Either String (Maybe [UpdateTarget] -> MaintenanceTrack)
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
"MaintenanceTrackName")
Either String (Maybe [UpdateTarget] -> MaintenanceTrack)
-> Either String (Maybe [UpdateTarget])
-> Either String MaintenanceTrack
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"UpdateTargets" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [UpdateTarget]))
-> Either String (Maybe [UpdateTarget])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [UpdateTarget])
-> [Node] -> Either String (Maybe [UpdateTarget])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [UpdateTarget]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"UpdateTarget")
)
instance Prelude.Hashable MaintenanceTrack
instance Prelude.NFData MaintenanceTrack