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

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

-- | The status of the service update on the node group
--
-- /See:/ 'newNodeGroupUpdateStatus' smart constructor.
data NodeGroupUpdateStatus = NodeGroupUpdateStatus'
  { -- | The status of the service update on the node group member
    NodeGroupUpdateStatus -> Maybe [NodeGroupMemberUpdateStatus]
nodeGroupMemberUpdateStatus :: Prelude.Maybe [NodeGroupMemberUpdateStatus],
    -- | The ID of the node group
    NodeGroupUpdateStatus -> Maybe Text
nodeGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (NodeGroupUpdateStatus -> NodeGroupUpdateStatus -> Bool
(NodeGroupUpdateStatus -> NodeGroupUpdateStatus -> Bool)
-> (NodeGroupUpdateStatus -> NodeGroupUpdateStatus -> Bool)
-> Eq NodeGroupUpdateStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeGroupUpdateStatus -> NodeGroupUpdateStatus -> Bool
$c/= :: NodeGroupUpdateStatus -> NodeGroupUpdateStatus -> Bool
== :: NodeGroupUpdateStatus -> NodeGroupUpdateStatus -> Bool
$c== :: NodeGroupUpdateStatus -> NodeGroupUpdateStatus -> Bool
Prelude.Eq, ReadPrec [NodeGroupUpdateStatus]
ReadPrec NodeGroupUpdateStatus
Int -> ReadS NodeGroupUpdateStatus
ReadS [NodeGroupUpdateStatus]
(Int -> ReadS NodeGroupUpdateStatus)
-> ReadS [NodeGroupUpdateStatus]
-> ReadPrec NodeGroupUpdateStatus
-> ReadPrec [NodeGroupUpdateStatus]
-> Read NodeGroupUpdateStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeGroupUpdateStatus]
$creadListPrec :: ReadPrec [NodeGroupUpdateStatus]
readPrec :: ReadPrec NodeGroupUpdateStatus
$creadPrec :: ReadPrec NodeGroupUpdateStatus
readList :: ReadS [NodeGroupUpdateStatus]
$creadList :: ReadS [NodeGroupUpdateStatus]
readsPrec :: Int -> ReadS NodeGroupUpdateStatus
$creadsPrec :: Int -> ReadS NodeGroupUpdateStatus
Prelude.Read, Int -> NodeGroupUpdateStatus -> ShowS
[NodeGroupUpdateStatus] -> ShowS
NodeGroupUpdateStatus -> String
(Int -> NodeGroupUpdateStatus -> ShowS)
-> (NodeGroupUpdateStatus -> String)
-> ([NodeGroupUpdateStatus] -> ShowS)
-> Show NodeGroupUpdateStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeGroupUpdateStatus] -> ShowS
$cshowList :: [NodeGroupUpdateStatus] -> ShowS
show :: NodeGroupUpdateStatus -> String
$cshow :: NodeGroupUpdateStatus -> String
showsPrec :: Int -> NodeGroupUpdateStatus -> ShowS
$cshowsPrec :: Int -> NodeGroupUpdateStatus -> ShowS
Prelude.Show, (forall x. NodeGroupUpdateStatus -> Rep NodeGroupUpdateStatus x)
-> (forall x. Rep NodeGroupUpdateStatus x -> NodeGroupUpdateStatus)
-> Generic NodeGroupUpdateStatus
forall x. Rep NodeGroupUpdateStatus x -> NodeGroupUpdateStatus
forall x. NodeGroupUpdateStatus -> Rep NodeGroupUpdateStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeGroupUpdateStatus x -> NodeGroupUpdateStatus
$cfrom :: forall x. NodeGroupUpdateStatus -> Rep NodeGroupUpdateStatus x
Prelude.Generic)

-- |
-- Create a value of 'NodeGroupUpdateStatus' 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:
--
-- 'nodeGroupMemberUpdateStatus', 'nodeGroupUpdateStatus_nodeGroupMemberUpdateStatus' - The status of the service update on the node group member
--
-- 'nodeGroupId', 'nodeGroupUpdateStatus_nodeGroupId' - The ID of the node group
newNodeGroupUpdateStatus ::
  NodeGroupUpdateStatus
newNodeGroupUpdateStatus :: NodeGroupUpdateStatus
newNodeGroupUpdateStatus =
  NodeGroupUpdateStatus' :: Maybe [NodeGroupMemberUpdateStatus]
-> Maybe Text -> NodeGroupUpdateStatus
NodeGroupUpdateStatus'
    { $sel:nodeGroupMemberUpdateStatus:NodeGroupUpdateStatus' :: Maybe [NodeGroupMemberUpdateStatus]
nodeGroupMemberUpdateStatus =
        Maybe [NodeGroupMemberUpdateStatus]
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeGroupId:NodeGroupUpdateStatus' :: Maybe Text
nodeGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the service update on the node group member
nodeGroupUpdateStatus_nodeGroupMemberUpdateStatus :: Lens.Lens' NodeGroupUpdateStatus (Prelude.Maybe [NodeGroupMemberUpdateStatus])
nodeGroupUpdateStatus_nodeGroupMemberUpdateStatus :: (Maybe [NodeGroupMemberUpdateStatus]
 -> f (Maybe [NodeGroupMemberUpdateStatus]))
-> NodeGroupUpdateStatus -> f NodeGroupUpdateStatus
nodeGroupUpdateStatus_nodeGroupMemberUpdateStatus = (NodeGroupUpdateStatus -> Maybe [NodeGroupMemberUpdateStatus])
-> (NodeGroupUpdateStatus
    -> Maybe [NodeGroupMemberUpdateStatus] -> NodeGroupUpdateStatus)
-> Lens
     NodeGroupUpdateStatus
     NodeGroupUpdateStatus
     (Maybe [NodeGroupMemberUpdateStatus])
     (Maybe [NodeGroupMemberUpdateStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroupUpdateStatus' {Maybe [NodeGroupMemberUpdateStatus]
nodeGroupMemberUpdateStatus :: Maybe [NodeGroupMemberUpdateStatus]
$sel:nodeGroupMemberUpdateStatus:NodeGroupUpdateStatus' :: NodeGroupUpdateStatus -> Maybe [NodeGroupMemberUpdateStatus]
nodeGroupMemberUpdateStatus} -> Maybe [NodeGroupMemberUpdateStatus]
nodeGroupMemberUpdateStatus) (\s :: NodeGroupUpdateStatus
s@NodeGroupUpdateStatus' {} Maybe [NodeGroupMemberUpdateStatus]
a -> NodeGroupUpdateStatus
s {$sel:nodeGroupMemberUpdateStatus:NodeGroupUpdateStatus' :: Maybe [NodeGroupMemberUpdateStatus]
nodeGroupMemberUpdateStatus = Maybe [NodeGroupMemberUpdateStatus]
a} :: NodeGroupUpdateStatus) ((Maybe [NodeGroupMemberUpdateStatus]
  -> f (Maybe [NodeGroupMemberUpdateStatus]))
 -> NodeGroupUpdateStatus -> f NodeGroupUpdateStatus)
-> ((Maybe [NodeGroupMemberUpdateStatus]
     -> f (Maybe [NodeGroupMemberUpdateStatus]))
    -> Maybe [NodeGroupMemberUpdateStatus]
    -> f (Maybe [NodeGroupMemberUpdateStatus]))
-> (Maybe [NodeGroupMemberUpdateStatus]
    -> f (Maybe [NodeGroupMemberUpdateStatus]))
-> NodeGroupUpdateStatus
-> f NodeGroupUpdateStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NodeGroupMemberUpdateStatus]
  [NodeGroupMemberUpdateStatus]
  [NodeGroupMemberUpdateStatus]
  [NodeGroupMemberUpdateStatus]
-> Iso
     (Maybe [NodeGroupMemberUpdateStatus])
     (Maybe [NodeGroupMemberUpdateStatus])
     (Maybe [NodeGroupMemberUpdateStatus])
     (Maybe [NodeGroupMemberUpdateStatus])
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
  [NodeGroupMemberUpdateStatus]
  [NodeGroupMemberUpdateStatus]
  [NodeGroupMemberUpdateStatus]
  [NodeGroupMemberUpdateStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the node group
nodeGroupUpdateStatus_nodeGroupId :: Lens.Lens' NodeGroupUpdateStatus (Prelude.Maybe Prelude.Text)
nodeGroupUpdateStatus_nodeGroupId :: (Maybe Text -> f (Maybe Text))
-> NodeGroupUpdateStatus -> f NodeGroupUpdateStatus
nodeGroupUpdateStatus_nodeGroupId = (NodeGroupUpdateStatus -> Maybe Text)
-> (NodeGroupUpdateStatus -> Maybe Text -> NodeGroupUpdateStatus)
-> Lens
     NodeGroupUpdateStatus
     NodeGroupUpdateStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeGroupUpdateStatus' {Maybe Text
nodeGroupId :: Maybe Text
$sel:nodeGroupId:NodeGroupUpdateStatus' :: NodeGroupUpdateStatus -> Maybe Text
nodeGroupId} -> Maybe Text
nodeGroupId) (\s :: NodeGroupUpdateStatus
s@NodeGroupUpdateStatus' {} Maybe Text
a -> NodeGroupUpdateStatus
s {$sel:nodeGroupId:NodeGroupUpdateStatus' :: Maybe Text
nodeGroupId = Maybe Text
a} :: NodeGroupUpdateStatus)

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

instance Prelude.Hashable NodeGroupUpdateStatus

instance Prelude.NFData NodeGroupUpdateStatus