{-# 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.ElastiCache.Types.CacheParameterGroupStatus
-- 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.ElastiCache.Types.CacheParameterGroupStatus where

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

-- | Status of the cache parameter group.
--
-- /See:/ 'newCacheParameterGroupStatus' smart constructor.
data CacheParameterGroupStatus = CacheParameterGroupStatus'
  { -- | The name of the cache parameter group.
    CacheParameterGroupStatus -> Maybe Text
cacheParameterGroupName :: Prelude.Maybe Prelude.Text,
    -- | A list of the cache node IDs which need to be rebooted for parameter
    -- changes to be applied. A node ID is a numeric identifier (0001, 0002,
    -- etc.).
    CacheParameterGroupStatus -> Maybe [Text]
cacheNodeIdsToReboot :: Prelude.Maybe [Prelude.Text],
    -- | The status of parameter updates.
    CacheParameterGroupStatus -> Maybe Text
parameterApplyStatus :: Prelude.Maybe Prelude.Text
  }
  deriving (CacheParameterGroupStatus -> CacheParameterGroupStatus -> Bool
(CacheParameterGroupStatus -> CacheParameterGroupStatus -> Bool)
-> (CacheParameterGroupStatus -> CacheParameterGroupStatus -> Bool)
-> Eq CacheParameterGroupStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CacheParameterGroupStatus -> CacheParameterGroupStatus -> Bool
$c/= :: CacheParameterGroupStatus -> CacheParameterGroupStatus -> Bool
== :: CacheParameterGroupStatus -> CacheParameterGroupStatus -> Bool
$c== :: CacheParameterGroupStatus -> CacheParameterGroupStatus -> Bool
Prelude.Eq, ReadPrec [CacheParameterGroupStatus]
ReadPrec CacheParameterGroupStatus
Int -> ReadS CacheParameterGroupStatus
ReadS [CacheParameterGroupStatus]
(Int -> ReadS CacheParameterGroupStatus)
-> ReadS [CacheParameterGroupStatus]
-> ReadPrec CacheParameterGroupStatus
-> ReadPrec [CacheParameterGroupStatus]
-> Read CacheParameterGroupStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CacheParameterGroupStatus]
$creadListPrec :: ReadPrec [CacheParameterGroupStatus]
readPrec :: ReadPrec CacheParameterGroupStatus
$creadPrec :: ReadPrec CacheParameterGroupStatus
readList :: ReadS [CacheParameterGroupStatus]
$creadList :: ReadS [CacheParameterGroupStatus]
readsPrec :: Int -> ReadS CacheParameterGroupStatus
$creadsPrec :: Int -> ReadS CacheParameterGroupStatus
Prelude.Read, Int -> CacheParameterGroupStatus -> ShowS
[CacheParameterGroupStatus] -> ShowS
CacheParameterGroupStatus -> String
(Int -> CacheParameterGroupStatus -> ShowS)
-> (CacheParameterGroupStatus -> String)
-> ([CacheParameterGroupStatus] -> ShowS)
-> Show CacheParameterGroupStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CacheParameterGroupStatus] -> ShowS
$cshowList :: [CacheParameterGroupStatus] -> ShowS
show :: CacheParameterGroupStatus -> String
$cshow :: CacheParameterGroupStatus -> String
showsPrec :: Int -> CacheParameterGroupStatus -> ShowS
$cshowsPrec :: Int -> CacheParameterGroupStatus -> ShowS
Prelude.Show, (forall x.
 CacheParameterGroupStatus -> Rep CacheParameterGroupStatus x)
-> (forall x.
    Rep CacheParameterGroupStatus x -> CacheParameterGroupStatus)
-> Generic CacheParameterGroupStatus
forall x.
Rep CacheParameterGroupStatus x -> CacheParameterGroupStatus
forall x.
CacheParameterGroupStatus -> Rep CacheParameterGroupStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CacheParameterGroupStatus x -> CacheParameterGroupStatus
$cfrom :: forall x.
CacheParameterGroupStatus -> Rep CacheParameterGroupStatus x
Prelude.Generic)

-- |
-- Create a value of 'CacheParameterGroupStatus' 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:
--
-- 'cacheParameterGroupName', 'cacheParameterGroupStatus_cacheParameterGroupName' - The name of the cache parameter group.
--
-- 'cacheNodeIdsToReboot', 'cacheParameterGroupStatus_cacheNodeIdsToReboot' - A list of the cache node IDs which need to be rebooted for parameter
-- changes to be applied. A node ID is a numeric identifier (0001, 0002,
-- etc.).
--
-- 'parameterApplyStatus', 'cacheParameterGroupStatus_parameterApplyStatus' - The status of parameter updates.
newCacheParameterGroupStatus ::
  CacheParameterGroupStatus
newCacheParameterGroupStatus :: CacheParameterGroupStatus
newCacheParameterGroupStatus =
  CacheParameterGroupStatus' :: Maybe Text
-> Maybe [Text] -> Maybe Text -> CacheParameterGroupStatus
CacheParameterGroupStatus'
    { $sel:cacheParameterGroupName:CacheParameterGroupStatus' :: Maybe Text
cacheParameterGroupName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheNodeIdsToReboot:CacheParameterGroupStatus' :: Maybe [Text]
cacheNodeIdsToReboot = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterApplyStatus:CacheParameterGroupStatus' :: Maybe Text
parameterApplyStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the cache parameter group.
cacheParameterGroupStatus_cacheParameterGroupName :: Lens.Lens' CacheParameterGroupStatus (Prelude.Maybe Prelude.Text)
cacheParameterGroupStatus_cacheParameterGroupName :: (Maybe Text -> f (Maybe Text))
-> CacheParameterGroupStatus -> f CacheParameterGroupStatus
cacheParameterGroupStatus_cacheParameterGroupName = (CacheParameterGroupStatus -> Maybe Text)
-> (CacheParameterGroupStatus
    -> Maybe Text -> CacheParameterGroupStatus)
-> Lens
     CacheParameterGroupStatus
     CacheParameterGroupStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheParameterGroupStatus' {Maybe Text
cacheParameterGroupName :: Maybe Text
$sel:cacheParameterGroupName:CacheParameterGroupStatus' :: CacheParameterGroupStatus -> Maybe Text
cacheParameterGroupName} -> Maybe Text
cacheParameterGroupName) (\s :: CacheParameterGroupStatus
s@CacheParameterGroupStatus' {} Maybe Text
a -> CacheParameterGroupStatus
s {$sel:cacheParameterGroupName:CacheParameterGroupStatus' :: Maybe Text
cacheParameterGroupName = Maybe Text
a} :: CacheParameterGroupStatus)

-- | A list of the cache node IDs which need to be rebooted for parameter
-- changes to be applied. A node ID is a numeric identifier (0001, 0002,
-- etc.).
cacheParameterGroupStatus_cacheNodeIdsToReboot :: Lens.Lens' CacheParameterGroupStatus (Prelude.Maybe [Prelude.Text])
cacheParameterGroupStatus_cacheNodeIdsToReboot :: (Maybe [Text] -> f (Maybe [Text]))
-> CacheParameterGroupStatus -> f CacheParameterGroupStatus
cacheParameterGroupStatus_cacheNodeIdsToReboot = (CacheParameterGroupStatus -> Maybe [Text])
-> (CacheParameterGroupStatus
    -> Maybe [Text] -> CacheParameterGroupStatus)
-> Lens
     CacheParameterGroupStatus
     CacheParameterGroupStatus
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheParameterGroupStatus' {Maybe [Text]
cacheNodeIdsToReboot :: Maybe [Text]
$sel:cacheNodeIdsToReboot:CacheParameterGroupStatus' :: CacheParameterGroupStatus -> Maybe [Text]
cacheNodeIdsToReboot} -> Maybe [Text]
cacheNodeIdsToReboot) (\s :: CacheParameterGroupStatus
s@CacheParameterGroupStatus' {} Maybe [Text]
a -> CacheParameterGroupStatus
s {$sel:cacheNodeIdsToReboot:CacheParameterGroupStatus' :: Maybe [Text]
cacheNodeIdsToReboot = Maybe [Text]
a} :: CacheParameterGroupStatus) ((Maybe [Text] -> f (Maybe [Text]))
 -> CacheParameterGroupStatus -> f CacheParameterGroupStatus)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CacheParameterGroupStatus
-> f CacheParameterGroupStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The status of parameter updates.
cacheParameterGroupStatus_parameterApplyStatus :: Lens.Lens' CacheParameterGroupStatus (Prelude.Maybe Prelude.Text)
cacheParameterGroupStatus_parameterApplyStatus :: (Maybe Text -> f (Maybe Text))
-> CacheParameterGroupStatus -> f CacheParameterGroupStatus
cacheParameterGroupStatus_parameterApplyStatus = (CacheParameterGroupStatus -> Maybe Text)
-> (CacheParameterGroupStatus
    -> Maybe Text -> CacheParameterGroupStatus)
-> Lens
     CacheParameterGroupStatus
     CacheParameterGroupStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheParameterGroupStatus' {Maybe Text
parameterApplyStatus :: Maybe Text
$sel:parameterApplyStatus:CacheParameterGroupStatus' :: CacheParameterGroupStatus -> Maybe Text
parameterApplyStatus} -> Maybe Text
parameterApplyStatus) (\s :: CacheParameterGroupStatus
s@CacheParameterGroupStatus' {} Maybe Text
a -> CacheParameterGroupStatus
s {$sel:parameterApplyStatus:CacheParameterGroupStatus' :: Maybe Text
parameterApplyStatus = Maybe Text
a} :: CacheParameterGroupStatus)

instance Core.FromXML CacheParameterGroupStatus where
  parseXML :: [Node] -> Either String CacheParameterGroupStatus
parseXML [Node]
x =
    Maybe Text
-> Maybe [Text] -> Maybe Text -> CacheParameterGroupStatus
CacheParameterGroupStatus'
      (Maybe Text
 -> Maybe [Text] -> Maybe Text -> CacheParameterGroupStatus)
-> Either String (Maybe Text)
-> Either
     String (Maybe [Text] -> Maybe Text -> CacheParameterGroupStatus)
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
"CacheParameterGroupName")
      Either
  String (Maybe [Text] -> Maybe Text -> CacheParameterGroupStatus)
-> Either String (Maybe [Text])
-> Either String (Maybe Text -> CacheParameterGroupStatus)
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
"CacheNodeIdsToReboot"
                      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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"CacheNodeId")
                  )
      Either String (Maybe Text -> CacheParameterGroupStatus)
-> Either String (Maybe Text)
-> Either String CacheParameterGroupStatus
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 CacheParameterGroupStatus

instance Prelude.NFData CacheParameterGroupStatus