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

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

-- | Describes the status of a parameter group.
--
-- /See:/ 'newClusterParameterStatus' smart constructor.
data ClusterParameterStatus = ClusterParameterStatus'
  { -- | The error that prevented the parameter from being applied to the
    -- database.
    ClusterParameterStatus -> Maybe Text
parameterApplyErrorDescription :: Prelude.Maybe Prelude.Text,
    -- | The name of the parameter.
    ClusterParameterStatus -> Maybe Text
parameterName :: Prelude.Maybe Prelude.Text,
    -- | The status of the parameter that indicates whether the parameter is in
    -- sync with the database, waiting for a cluster reboot, or encountered an
    -- error when being applied.
    --
    -- The following are possible statuses and descriptions.
    --
    -- -   @in-sync@: The parameter value is in sync with the database.
    --
    -- -   @pending-reboot@: The parameter value will be applied after the
    --     cluster reboots.
    --
    -- -   @applying@: The parameter value is being applied to the database.
    --
    -- -   @invalid-parameter@: Cannot apply the parameter value because it has
    --     an invalid value or syntax.
    --
    -- -   @apply-deferred@: The parameter contains static property changes.
    --     The changes are deferred until the cluster reboots.
    --
    -- -   @apply-error@: Cannot connect to the cluster. The parameter change
    --     will be applied after the cluster reboots.
    --
    -- -   @unknown-error@: Cannot apply the parameter change right now. The
    --     change will be applied after the cluster reboots.
    ClusterParameterStatus -> Maybe Text
parameterApplyStatus :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterParameterStatus -> ClusterParameterStatus -> Bool
(ClusterParameterStatus -> ClusterParameterStatus -> Bool)
-> (ClusterParameterStatus -> ClusterParameterStatus -> Bool)
-> Eq ClusterParameterStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterParameterStatus -> ClusterParameterStatus -> Bool
$c/= :: ClusterParameterStatus -> ClusterParameterStatus -> Bool
== :: ClusterParameterStatus -> ClusterParameterStatus -> Bool
$c== :: ClusterParameterStatus -> ClusterParameterStatus -> Bool
Prelude.Eq, ReadPrec [ClusterParameterStatus]
ReadPrec ClusterParameterStatus
Int -> ReadS ClusterParameterStatus
ReadS [ClusterParameterStatus]
(Int -> ReadS ClusterParameterStatus)
-> ReadS [ClusterParameterStatus]
-> ReadPrec ClusterParameterStatus
-> ReadPrec [ClusterParameterStatus]
-> Read ClusterParameterStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterParameterStatus]
$creadListPrec :: ReadPrec [ClusterParameterStatus]
readPrec :: ReadPrec ClusterParameterStatus
$creadPrec :: ReadPrec ClusterParameterStatus
readList :: ReadS [ClusterParameterStatus]
$creadList :: ReadS [ClusterParameterStatus]
readsPrec :: Int -> ReadS ClusterParameterStatus
$creadsPrec :: Int -> ReadS ClusterParameterStatus
Prelude.Read, Int -> ClusterParameterStatus -> ShowS
[ClusterParameterStatus] -> ShowS
ClusterParameterStatus -> String
(Int -> ClusterParameterStatus -> ShowS)
-> (ClusterParameterStatus -> String)
-> ([ClusterParameterStatus] -> ShowS)
-> Show ClusterParameterStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterParameterStatus] -> ShowS
$cshowList :: [ClusterParameterStatus] -> ShowS
show :: ClusterParameterStatus -> String
$cshow :: ClusterParameterStatus -> String
showsPrec :: Int -> ClusterParameterStatus -> ShowS
$cshowsPrec :: Int -> ClusterParameterStatus -> ShowS
Prelude.Show, (forall x. ClusterParameterStatus -> Rep ClusterParameterStatus x)
-> (forall x.
    Rep ClusterParameterStatus x -> ClusterParameterStatus)
-> Generic ClusterParameterStatus
forall x. Rep ClusterParameterStatus x -> ClusterParameterStatus
forall x. ClusterParameterStatus -> Rep ClusterParameterStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterParameterStatus x -> ClusterParameterStatus
$cfrom :: forall x. ClusterParameterStatus -> Rep ClusterParameterStatus x
Prelude.Generic)

-- |
-- Create a value of 'ClusterParameterStatus' 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:
--
-- 'parameterApplyErrorDescription', 'clusterParameterStatus_parameterApplyErrorDescription' - The error that prevented the parameter from being applied to the
-- database.
--
-- 'parameterName', 'clusterParameterStatus_parameterName' - The name of the parameter.
--
-- 'parameterApplyStatus', 'clusterParameterStatus_parameterApplyStatus' - The status of the parameter that indicates whether the parameter is in
-- sync with the database, waiting for a cluster reboot, or encountered an
-- error when being applied.
--
-- The following are possible statuses and descriptions.
--
-- -   @in-sync@: The parameter value is in sync with the database.
--
-- -   @pending-reboot@: The parameter value will be applied after the
--     cluster reboots.
--
-- -   @applying@: The parameter value is being applied to the database.
--
-- -   @invalid-parameter@: Cannot apply the parameter value because it has
--     an invalid value or syntax.
--
-- -   @apply-deferred@: The parameter contains static property changes.
--     The changes are deferred until the cluster reboots.
--
-- -   @apply-error@: Cannot connect to the cluster. The parameter change
--     will be applied after the cluster reboots.
--
-- -   @unknown-error@: Cannot apply the parameter change right now. The
--     change will be applied after the cluster reboots.
newClusterParameterStatus ::
  ClusterParameterStatus
newClusterParameterStatus :: ClusterParameterStatus
newClusterParameterStatus =
  ClusterParameterStatus' :: Maybe Text -> Maybe Text -> Maybe Text -> ClusterParameterStatus
ClusterParameterStatus'
    { $sel:parameterApplyErrorDescription:ClusterParameterStatus' :: Maybe Text
parameterApplyErrorDescription =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterName:ClusterParameterStatus' :: Maybe Text
parameterName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterApplyStatus:ClusterParameterStatus' :: Maybe Text
parameterApplyStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The error that prevented the parameter from being applied to the
-- database.
clusterParameterStatus_parameterApplyErrorDescription :: Lens.Lens' ClusterParameterStatus (Prelude.Maybe Prelude.Text)
clusterParameterStatus_parameterApplyErrorDescription :: (Maybe Text -> f (Maybe Text))
-> ClusterParameterStatus -> f ClusterParameterStatus
clusterParameterStatus_parameterApplyErrorDescription = (ClusterParameterStatus -> Maybe Text)
-> (ClusterParameterStatus -> Maybe Text -> ClusterParameterStatus)
-> Lens
     ClusterParameterStatus
     ClusterParameterStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterParameterStatus' {Maybe Text
parameterApplyErrorDescription :: Maybe Text
$sel:parameterApplyErrorDescription:ClusterParameterStatus' :: ClusterParameterStatus -> Maybe Text
parameterApplyErrorDescription} -> Maybe Text
parameterApplyErrorDescription) (\s :: ClusterParameterStatus
s@ClusterParameterStatus' {} Maybe Text
a -> ClusterParameterStatus
s {$sel:parameterApplyErrorDescription:ClusterParameterStatus' :: Maybe Text
parameterApplyErrorDescription = Maybe Text
a} :: ClusterParameterStatus)

-- | The name of the parameter.
clusterParameterStatus_parameterName :: Lens.Lens' ClusterParameterStatus (Prelude.Maybe Prelude.Text)
clusterParameterStatus_parameterName :: (Maybe Text -> f (Maybe Text))
-> ClusterParameterStatus -> f ClusterParameterStatus
clusterParameterStatus_parameterName = (ClusterParameterStatus -> Maybe Text)
-> (ClusterParameterStatus -> Maybe Text -> ClusterParameterStatus)
-> Lens
     ClusterParameterStatus
     ClusterParameterStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterParameterStatus' {Maybe Text
parameterName :: Maybe Text
$sel:parameterName:ClusterParameterStatus' :: ClusterParameterStatus -> Maybe Text
parameterName} -> Maybe Text
parameterName) (\s :: ClusterParameterStatus
s@ClusterParameterStatus' {} Maybe Text
a -> ClusterParameterStatus
s {$sel:parameterName:ClusterParameterStatus' :: Maybe Text
parameterName = Maybe Text
a} :: ClusterParameterStatus)

-- | The status of the parameter that indicates whether the parameter is in
-- sync with the database, waiting for a cluster reboot, or encountered an
-- error when being applied.
--
-- The following are possible statuses and descriptions.
--
-- -   @in-sync@: The parameter value is in sync with the database.
--
-- -   @pending-reboot@: The parameter value will be applied after the
--     cluster reboots.
--
-- -   @applying@: The parameter value is being applied to the database.
--
-- -   @invalid-parameter@: Cannot apply the parameter value because it has
--     an invalid value or syntax.
--
-- -   @apply-deferred@: The parameter contains static property changes.
--     The changes are deferred until the cluster reboots.
--
-- -   @apply-error@: Cannot connect to the cluster. The parameter change
--     will be applied after the cluster reboots.
--
-- -   @unknown-error@: Cannot apply the parameter change right now. The
--     change will be applied after the cluster reboots.
clusterParameterStatus_parameterApplyStatus :: Lens.Lens' ClusterParameterStatus (Prelude.Maybe Prelude.Text)
clusterParameterStatus_parameterApplyStatus :: (Maybe Text -> f (Maybe Text))
-> ClusterParameterStatus -> f ClusterParameterStatus
clusterParameterStatus_parameterApplyStatus = (ClusterParameterStatus -> Maybe Text)
-> (ClusterParameterStatus -> Maybe Text -> ClusterParameterStatus)
-> Lens
     ClusterParameterStatus
     ClusterParameterStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterParameterStatus' {Maybe Text
parameterApplyStatus :: Maybe Text
$sel:parameterApplyStatus:ClusterParameterStatus' :: ClusterParameterStatus -> Maybe Text
parameterApplyStatus} -> Maybe Text
parameterApplyStatus) (\s :: ClusterParameterStatus
s@ClusterParameterStatus' {} Maybe Text
a -> ClusterParameterStatus
s {$sel:parameterApplyStatus:ClusterParameterStatus' :: Maybe Text
parameterApplyStatus = Maybe Text
a} :: ClusterParameterStatus)

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

instance Prelude.Hashable ClusterParameterStatus

instance Prelude.NFData ClusterParameterStatus