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

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.Types.UpdateActionStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Update action that has been processed for the corresponding apply\/stop
-- request
--
-- /See:/ 'newProcessedUpdateAction' smart constructor.
data ProcessedUpdateAction = ProcessedUpdateAction'
  { -- | The ID of the cache cluster
    ProcessedUpdateAction -> Maybe Text
cacheClusterId :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of the service update
    ProcessedUpdateAction -> Maybe Text
serviceUpdateName :: Prelude.Maybe Prelude.Text,
    -- | The status of the update action on the Redis cluster
    ProcessedUpdateAction -> Maybe UpdateActionStatus
updateActionStatus :: Prelude.Maybe UpdateActionStatus,
    -- | The ID of the replication group
    ProcessedUpdateAction -> Maybe Text
replicationGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (ProcessedUpdateAction -> ProcessedUpdateAction -> Bool
(ProcessedUpdateAction -> ProcessedUpdateAction -> Bool)
-> (ProcessedUpdateAction -> ProcessedUpdateAction -> Bool)
-> Eq ProcessedUpdateAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProcessedUpdateAction -> ProcessedUpdateAction -> Bool
$c/= :: ProcessedUpdateAction -> ProcessedUpdateAction -> Bool
== :: ProcessedUpdateAction -> ProcessedUpdateAction -> Bool
$c== :: ProcessedUpdateAction -> ProcessedUpdateAction -> Bool
Prelude.Eq, ReadPrec [ProcessedUpdateAction]
ReadPrec ProcessedUpdateAction
Int -> ReadS ProcessedUpdateAction
ReadS [ProcessedUpdateAction]
(Int -> ReadS ProcessedUpdateAction)
-> ReadS [ProcessedUpdateAction]
-> ReadPrec ProcessedUpdateAction
-> ReadPrec [ProcessedUpdateAction]
-> Read ProcessedUpdateAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProcessedUpdateAction]
$creadListPrec :: ReadPrec [ProcessedUpdateAction]
readPrec :: ReadPrec ProcessedUpdateAction
$creadPrec :: ReadPrec ProcessedUpdateAction
readList :: ReadS [ProcessedUpdateAction]
$creadList :: ReadS [ProcessedUpdateAction]
readsPrec :: Int -> ReadS ProcessedUpdateAction
$creadsPrec :: Int -> ReadS ProcessedUpdateAction
Prelude.Read, Int -> ProcessedUpdateAction -> ShowS
[ProcessedUpdateAction] -> ShowS
ProcessedUpdateAction -> String
(Int -> ProcessedUpdateAction -> ShowS)
-> (ProcessedUpdateAction -> String)
-> ([ProcessedUpdateAction] -> ShowS)
-> Show ProcessedUpdateAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProcessedUpdateAction] -> ShowS
$cshowList :: [ProcessedUpdateAction] -> ShowS
show :: ProcessedUpdateAction -> String
$cshow :: ProcessedUpdateAction -> String
showsPrec :: Int -> ProcessedUpdateAction -> ShowS
$cshowsPrec :: Int -> ProcessedUpdateAction -> ShowS
Prelude.Show, (forall x. ProcessedUpdateAction -> Rep ProcessedUpdateAction x)
-> (forall x. Rep ProcessedUpdateAction x -> ProcessedUpdateAction)
-> Generic ProcessedUpdateAction
forall x. Rep ProcessedUpdateAction x -> ProcessedUpdateAction
forall x. ProcessedUpdateAction -> Rep ProcessedUpdateAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProcessedUpdateAction x -> ProcessedUpdateAction
$cfrom :: forall x. ProcessedUpdateAction -> Rep ProcessedUpdateAction x
Prelude.Generic)

-- |
-- Create a value of 'ProcessedUpdateAction' 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:
--
-- 'cacheClusterId', 'processedUpdateAction_cacheClusterId' - The ID of the cache cluster
--
-- 'serviceUpdateName', 'processedUpdateAction_serviceUpdateName' - The unique ID of the service update
--
-- 'updateActionStatus', 'processedUpdateAction_updateActionStatus' - The status of the update action on the Redis cluster
--
-- 'replicationGroupId', 'processedUpdateAction_replicationGroupId' - The ID of the replication group
newProcessedUpdateAction ::
  ProcessedUpdateAction
newProcessedUpdateAction :: ProcessedUpdateAction
newProcessedUpdateAction =
  ProcessedUpdateAction' :: Maybe Text
-> Maybe Text
-> Maybe UpdateActionStatus
-> Maybe Text
-> ProcessedUpdateAction
ProcessedUpdateAction'
    { $sel:cacheClusterId:ProcessedUpdateAction' :: Maybe Text
cacheClusterId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceUpdateName:ProcessedUpdateAction' :: Maybe Text
serviceUpdateName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updateActionStatus:ProcessedUpdateAction' :: Maybe UpdateActionStatus
updateActionStatus = Maybe UpdateActionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationGroupId:ProcessedUpdateAction' :: Maybe Text
replicationGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the cache cluster
processedUpdateAction_cacheClusterId :: Lens.Lens' ProcessedUpdateAction (Prelude.Maybe Prelude.Text)
processedUpdateAction_cacheClusterId :: (Maybe Text -> f (Maybe Text))
-> ProcessedUpdateAction -> f ProcessedUpdateAction
processedUpdateAction_cacheClusterId = (ProcessedUpdateAction -> Maybe Text)
-> (ProcessedUpdateAction -> Maybe Text -> ProcessedUpdateAction)
-> Lens
     ProcessedUpdateAction
     ProcessedUpdateAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessedUpdateAction' {Maybe Text
cacheClusterId :: Maybe Text
$sel:cacheClusterId:ProcessedUpdateAction' :: ProcessedUpdateAction -> Maybe Text
cacheClusterId} -> Maybe Text
cacheClusterId) (\s :: ProcessedUpdateAction
s@ProcessedUpdateAction' {} Maybe Text
a -> ProcessedUpdateAction
s {$sel:cacheClusterId:ProcessedUpdateAction' :: Maybe Text
cacheClusterId = Maybe Text
a} :: ProcessedUpdateAction)

-- | The unique ID of the service update
processedUpdateAction_serviceUpdateName :: Lens.Lens' ProcessedUpdateAction (Prelude.Maybe Prelude.Text)
processedUpdateAction_serviceUpdateName :: (Maybe Text -> f (Maybe Text))
-> ProcessedUpdateAction -> f ProcessedUpdateAction
processedUpdateAction_serviceUpdateName = (ProcessedUpdateAction -> Maybe Text)
-> (ProcessedUpdateAction -> Maybe Text -> ProcessedUpdateAction)
-> Lens
     ProcessedUpdateAction
     ProcessedUpdateAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessedUpdateAction' {Maybe Text
serviceUpdateName :: Maybe Text
$sel:serviceUpdateName:ProcessedUpdateAction' :: ProcessedUpdateAction -> Maybe Text
serviceUpdateName} -> Maybe Text
serviceUpdateName) (\s :: ProcessedUpdateAction
s@ProcessedUpdateAction' {} Maybe Text
a -> ProcessedUpdateAction
s {$sel:serviceUpdateName:ProcessedUpdateAction' :: Maybe Text
serviceUpdateName = Maybe Text
a} :: ProcessedUpdateAction)

-- | The status of the update action on the Redis cluster
processedUpdateAction_updateActionStatus :: Lens.Lens' ProcessedUpdateAction (Prelude.Maybe UpdateActionStatus)
processedUpdateAction_updateActionStatus :: (Maybe UpdateActionStatus -> f (Maybe UpdateActionStatus))
-> ProcessedUpdateAction -> f ProcessedUpdateAction
processedUpdateAction_updateActionStatus = (ProcessedUpdateAction -> Maybe UpdateActionStatus)
-> (ProcessedUpdateAction
    -> Maybe UpdateActionStatus -> ProcessedUpdateAction)
-> Lens
     ProcessedUpdateAction
     ProcessedUpdateAction
     (Maybe UpdateActionStatus)
     (Maybe UpdateActionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessedUpdateAction' {Maybe UpdateActionStatus
updateActionStatus :: Maybe UpdateActionStatus
$sel:updateActionStatus:ProcessedUpdateAction' :: ProcessedUpdateAction -> Maybe UpdateActionStatus
updateActionStatus} -> Maybe UpdateActionStatus
updateActionStatus) (\s :: ProcessedUpdateAction
s@ProcessedUpdateAction' {} Maybe UpdateActionStatus
a -> ProcessedUpdateAction
s {$sel:updateActionStatus:ProcessedUpdateAction' :: Maybe UpdateActionStatus
updateActionStatus = Maybe UpdateActionStatus
a} :: ProcessedUpdateAction)

-- | The ID of the replication group
processedUpdateAction_replicationGroupId :: Lens.Lens' ProcessedUpdateAction (Prelude.Maybe Prelude.Text)
processedUpdateAction_replicationGroupId :: (Maybe Text -> f (Maybe Text))
-> ProcessedUpdateAction -> f ProcessedUpdateAction
processedUpdateAction_replicationGroupId = (ProcessedUpdateAction -> Maybe Text)
-> (ProcessedUpdateAction -> Maybe Text -> ProcessedUpdateAction)
-> Lens
     ProcessedUpdateAction
     ProcessedUpdateAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessedUpdateAction' {Maybe Text
replicationGroupId :: Maybe Text
$sel:replicationGroupId:ProcessedUpdateAction' :: ProcessedUpdateAction -> Maybe Text
replicationGroupId} -> Maybe Text
replicationGroupId) (\s :: ProcessedUpdateAction
s@ProcessedUpdateAction' {} Maybe Text
a -> ProcessedUpdateAction
s {$sel:replicationGroupId:ProcessedUpdateAction' :: Maybe Text
replicationGroupId = Maybe Text
a} :: ProcessedUpdateAction)

instance Core.FromXML ProcessedUpdateAction where
  parseXML :: [Node] -> Either String ProcessedUpdateAction
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe UpdateActionStatus
-> Maybe Text
-> ProcessedUpdateAction
ProcessedUpdateAction'
      (Maybe Text
 -> Maybe Text
 -> Maybe UpdateActionStatus
 -> Maybe Text
 -> ProcessedUpdateAction)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe UpdateActionStatus -> Maybe Text -> ProcessedUpdateAction)
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
"CacheClusterId")
      Either
  String
  (Maybe Text
   -> Maybe UpdateActionStatus -> Maybe Text -> ProcessedUpdateAction)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe UpdateActionStatus -> Maybe Text -> ProcessedUpdateAction)
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
"ServiceUpdateName")
      Either
  String
  (Maybe UpdateActionStatus -> Maybe Text -> ProcessedUpdateAction)
-> Either String (Maybe UpdateActionStatus)
-> Either String (Maybe Text -> ProcessedUpdateAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe UpdateActionStatus)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"UpdateActionStatus")
      Either String (Maybe Text -> ProcessedUpdateAction)
-> Either String (Maybe Text)
-> Either String ProcessedUpdateAction
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
"ReplicationGroupId")

instance Prelude.Hashable ProcessedUpdateAction

instance Prelude.NFData ProcessedUpdateAction