{-# 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.ClusterVersion
-- 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.ClusterVersion 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 cluster version, including the parameter group family and
-- description of the version.
--
-- /See:/ 'newClusterVersion' smart constructor.
data ClusterVersion = ClusterVersion'
  { -- | The name of the cluster parameter group family for the cluster.
    ClusterVersion -> Maybe Text
clusterParameterGroupFamily :: Prelude.Maybe Prelude.Text,
    -- | The version number used by the cluster.
    ClusterVersion -> Maybe Text
clusterVersion :: Prelude.Maybe Prelude.Text,
    -- | The description of the cluster version.
    ClusterVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterVersion -> ClusterVersion -> Bool
(ClusterVersion -> ClusterVersion -> Bool)
-> (ClusterVersion -> ClusterVersion -> Bool) -> Eq ClusterVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterVersion -> ClusterVersion -> Bool
$c/= :: ClusterVersion -> ClusterVersion -> Bool
== :: ClusterVersion -> ClusterVersion -> Bool
$c== :: ClusterVersion -> ClusterVersion -> Bool
Prelude.Eq, ReadPrec [ClusterVersion]
ReadPrec ClusterVersion
Int -> ReadS ClusterVersion
ReadS [ClusterVersion]
(Int -> ReadS ClusterVersion)
-> ReadS [ClusterVersion]
-> ReadPrec ClusterVersion
-> ReadPrec [ClusterVersion]
-> Read ClusterVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterVersion]
$creadListPrec :: ReadPrec [ClusterVersion]
readPrec :: ReadPrec ClusterVersion
$creadPrec :: ReadPrec ClusterVersion
readList :: ReadS [ClusterVersion]
$creadList :: ReadS [ClusterVersion]
readsPrec :: Int -> ReadS ClusterVersion
$creadsPrec :: Int -> ReadS ClusterVersion
Prelude.Read, Int -> ClusterVersion -> ShowS
[ClusterVersion] -> ShowS
ClusterVersion -> String
(Int -> ClusterVersion -> ShowS)
-> (ClusterVersion -> String)
-> ([ClusterVersion] -> ShowS)
-> Show ClusterVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterVersion] -> ShowS
$cshowList :: [ClusterVersion] -> ShowS
show :: ClusterVersion -> String
$cshow :: ClusterVersion -> String
showsPrec :: Int -> ClusterVersion -> ShowS
$cshowsPrec :: Int -> ClusterVersion -> ShowS
Prelude.Show, (forall x. ClusterVersion -> Rep ClusterVersion x)
-> (forall x. Rep ClusterVersion x -> ClusterVersion)
-> Generic ClusterVersion
forall x. Rep ClusterVersion x -> ClusterVersion
forall x. ClusterVersion -> Rep ClusterVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterVersion x -> ClusterVersion
$cfrom :: forall x. ClusterVersion -> Rep ClusterVersion x
Prelude.Generic)

-- |
-- Create a value of 'ClusterVersion' 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:
--
-- 'clusterParameterGroupFamily', 'clusterVersion_clusterParameterGroupFamily' - The name of the cluster parameter group family for the cluster.
--
-- 'clusterVersion', 'clusterVersion_clusterVersion' - The version number used by the cluster.
--
-- 'description', 'clusterVersion_description' - The description of the cluster version.
newClusterVersion ::
  ClusterVersion
newClusterVersion :: ClusterVersion
newClusterVersion =
  ClusterVersion' :: Maybe Text -> Maybe Text -> Maybe Text -> ClusterVersion
ClusterVersion'
    { $sel:clusterParameterGroupFamily:ClusterVersion' :: Maybe Text
clusterParameterGroupFamily =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterVersion:ClusterVersion' :: Maybe Text
clusterVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ClusterVersion' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the cluster parameter group family for the cluster.
clusterVersion_clusterParameterGroupFamily :: Lens.Lens' ClusterVersion (Prelude.Maybe Prelude.Text)
clusterVersion_clusterParameterGroupFamily :: (Maybe Text -> f (Maybe Text))
-> ClusterVersion -> f ClusterVersion
clusterVersion_clusterParameterGroupFamily = (ClusterVersion -> Maybe Text)
-> (ClusterVersion -> Maybe Text -> ClusterVersion)
-> Lens ClusterVersion ClusterVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterVersion' {Maybe Text
clusterParameterGroupFamily :: Maybe Text
$sel:clusterParameterGroupFamily:ClusterVersion' :: ClusterVersion -> Maybe Text
clusterParameterGroupFamily} -> Maybe Text
clusterParameterGroupFamily) (\s :: ClusterVersion
s@ClusterVersion' {} Maybe Text
a -> ClusterVersion
s {$sel:clusterParameterGroupFamily:ClusterVersion' :: Maybe Text
clusterParameterGroupFamily = Maybe Text
a} :: ClusterVersion)

-- | The version number used by the cluster.
clusterVersion_clusterVersion :: Lens.Lens' ClusterVersion (Prelude.Maybe Prelude.Text)
clusterVersion_clusterVersion :: (Maybe Text -> f (Maybe Text))
-> ClusterVersion -> f ClusterVersion
clusterVersion_clusterVersion = (ClusterVersion -> Maybe Text)
-> (ClusterVersion -> Maybe Text -> ClusterVersion)
-> Lens ClusterVersion ClusterVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterVersion' {Maybe Text
clusterVersion :: Maybe Text
$sel:clusterVersion:ClusterVersion' :: ClusterVersion -> Maybe Text
clusterVersion} -> Maybe Text
clusterVersion) (\s :: ClusterVersion
s@ClusterVersion' {} Maybe Text
a -> ClusterVersion
s {$sel:clusterVersion:ClusterVersion' :: Maybe Text
clusterVersion = Maybe Text
a} :: ClusterVersion)

-- | The description of the cluster version.
clusterVersion_description :: Lens.Lens' ClusterVersion (Prelude.Maybe Prelude.Text)
clusterVersion_description :: (Maybe Text -> f (Maybe Text))
-> ClusterVersion -> f ClusterVersion
clusterVersion_description = (ClusterVersion -> Maybe Text)
-> (ClusterVersion -> Maybe Text -> ClusterVersion)
-> Lens ClusterVersion ClusterVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterVersion' {Maybe Text
description :: Maybe Text
$sel:description:ClusterVersion' :: ClusterVersion -> Maybe Text
description} -> Maybe Text
description) (\s :: ClusterVersion
s@ClusterVersion' {} Maybe Text
a -> ClusterVersion
s {$sel:description:ClusterVersion' :: Maybe Text
description = Maybe Text
a} :: ClusterVersion)

instance Core.FromXML ClusterVersion where
  parseXML :: [Node] -> Either String ClusterVersion
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> ClusterVersion
ClusterVersion'
      (Maybe Text -> Maybe Text -> Maybe Text -> ClusterVersion)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> ClusterVersion)
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
"ClusterParameterGroupFamily")
      Either String (Maybe Text -> Maybe Text -> ClusterVersion)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> ClusterVersion)
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
"ClusterVersion")
      Either String (Maybe Text -> ClusterVersion)
-> Either String (Maybe Text) -> Either String ClusterVersion
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 ClusterVersion

instance Prelude.NFData ClusterVersion