{-# 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.MemoryDb.Types.ClusterPendingUpdates
-- 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.MemoryDb.Types.ClusterPendingUpdates where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MemoryDb.Types.ACLsUpdateStatus
import Amazonka.MemoryDb.Types.PendingModifiedServiceUpdate
import Amazonka.MemoryDb.Types.ReshardingStatus
import qualified Amazonka.Prelude as Prelude

-- | A list of updates being applied to the cluster
--
-- /See:/ 'newClusterPendingUpdates' smart constructor.
data ClusterPendingUpdates = ClusterPendingUpdates'
  { -- | A list of service updates being applied to the cluster
    ClusterPendingUpdates -> Maybe [PendingModifiedServiceUpdate]
serviceUpdates :: Prelude.Maybe [PendingModifiedServiceUpdate],
    -- | The status of an online resharding operation.
    ClusterPendingUpdates -> Maybe ReshardingStatus
resharding :: Prelude.Maybe ReshardingStatus,
    -- | A list of ACLs associated with the cluster that are being updated
    ClusterPendingUpdates -> Maybe ACLsUpdateStatus
aCLs :: Prelude.Maybe ACLsUpdateStatus
  }
  deriving (ClusterPendingUpdates -> ClusterPendingUpdates -> Bool
(ClusterPendingUpdates -> ClusterPendingUpdates -> Bool)
-> (ClusterPendingUpdates -> ClusterPendingUpdates -> Bool)
-> Eq ClusterPendingUpdates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterPendingUpdates -> ClusterPendingUpdates -> Bool
$c/= :: ClusterPendingUpdates -> ClusterPendingUpdates -> Bool
== :: ClusterPendingUpdates -> ClusterPendingUpdates -> Bool
$c== :: ClusterPendingUpdates -> ClusterPendingUpdates -> Bool
Prelude.Eq, ReadPrec [ClusterPendingUpdates]
ReadPrec ClusterPendingUpdates
Int -> ReadS ClusterPendingUpdates
ReadS [ClusterPendingUpdates]
(Int -> ReadS ClusterPendingUpdates)
-> ReadS [ClusterPendingUpdates]
-> ReadPrec ClusterPendingUpdates
-> ReadPrec [ClusterPendingUpdates]
-> Read ClusterPendingUpdates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterPendingUpdates]
$creadListPrec :: ReadPrec [ClusterPendingUpdates]
readPrec :: ReadPrec ClusterPendingUpdates
$creadPrec :: ReadPrec ClusterPendingUpdates
readList :: ReadS [ClusterPendingUpdates]
$creadList :: ReadS [ClusterPendingUpdates]
readsPrec :: Int -> ReadS ClusterPendingUpdates
$creadsPrec :: Int -> ReadS ClusterPendingUpdates
Prelude.Read, Int -> ClusterPendingUpdates -> ShowS
[ClusterPendingUpdates] -> ShowS
ClusterPendingUpdates -> String
(Int -> ClusterPendingUpdates -> ShowS)
-> (ClusterPendingUpdates -> String)
-> ([ClusterPendingUpdates] -> ShowS)
-> Show ClusterPendingUpdates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterPendingUpdates] -> ShowS
$cshowList :: [ClusterPendingUpdates] -> ShowS
show :: ClusterPendingUpdates -> String
$cshow :: ClusterPendingUpdates -> String
showsPrec :: Int -> ClusterPendingUpdates -> ShowS
$cshowsPrec :: Int -> ClusterPendingUpdates -> ShowS
Prelude.Show, (forall x. ClusterPendingUpdates -> Rep ClusterPendingUpdates x)
-> (forall x. Rep ClusterPendingUpdates x -> ClusterPendingUpdates)
-> Generic ClusterPendingUpdates
forall x. Rep ClusterPendingUpdates x -> ClusterPendingUpdates
forall x. ClusterPendingUpdates -> Rep ClusterPendingUpdates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterPendingUpdates x -> ClusterPendingUpdates
$cfrom :: forall x. ClusterPendingUpdates -> Rep ClusterPendingUpdates x
Prelude.Generic)

-- |
-- Create a value of 'ClusterPendingUpdates' 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:
--
-- 'serviceUpdates', 'clusterPendingUpdates_serviceUpdates' - A list of service updates being applied to the cluster
--
-- 'resharding', 'clusterPendingUpdates_resharding' - The status of an online resharding operation.
--
-- 'aCLs', 'clusterPendingUpdates_aCLs' - A list of ACLs associated with the cluster that are being updated
newClusterPendingUpdates ::
  ClusterPendingUpdates
newClusterPendingUpdates :: ClusterPendingUpdates
newClusterPendingUpdates =
  ClusterPendingUpdates' :: Maybe [PendingModifiedServiceUpdate]
-> Maybe ReshardingStatus
-> Maybe ACLsUpdateStatus
-> ClusterPendingUpdates
ClusterPendingUpdates'
    { $sel:serviceUpdates:ClusterPendingUpdates' :: Maybe [PendingModifiedServiceUpdate]
serviceUpdates =
        Maybe [PendingModifiedServiceUpdate]
forall a. Maybe a
Prelude.Nothing,
      $sel:resharding:ClusterPendingUpdates' :: Maybe ReshardingStatus
resharding = Maybe ReshardingStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:aCLs:ClusterPendingUpdates' :: Maybe ACLsUpdateStatus
aCLs = Maybe ACLsUpdateStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of service updates being applied to the cluster
clusterPendingUpdates_serviceUpdates :: Lens.Lens' ClusterPendingUpdates (Prelude.Maybe [PendingModifiedServiceUpdate])
clusterPendingUpdates_serviceUpdates :: (Maybe [PendingModifiedServiceUpdate]
 -> f (Maybe [PendingModifiedServiceUpdate]))
-> ClusterPendingUpdates -> f ClusterPendingUpdates
clusterPendingUpdates_serviceUpdates = (ClusterPendingUpdates -> Maybe [PendingModifiedServiceUpdate])
-> (ClusterPendingUpdates
    -> Maybe [PendingModifiedServiceUpdate] -> ClusterPendingUpdates)
-> Lens
     ClusterPendingUpdates
     ClusterPendingUpdates
     (Maybe [PendingModifiedServiceUpdate])
     (Maybe [PendingModifiedServiceUpdate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterPendingUpdates' {Maybe [PendingModifiedServiceUpdate]
serviceUpdates :: Maybe [PendingModifiedServiceUpdate]
$sel:serviceUpdates:ClusterPendingUpdates' :: ClusterPendingUpdates -> Maybe [PendingModifiedServiceUpdate]
serviceUpdates} -> Maybe [PendingModifiedServiceUpdate]
serviceUpdates) (\s :: ClusterPendingUpdates
s@ClusterPendingUpdates' {} Maybe [PendingModifiedServiceUpdate]
a -> ClusterPendingUpdates
s {$sel:serviceUpdates:ClusterPendingUpdates' :: Maybe [PendingModifiedServiceUpdate]
serviceUpdates = Maybe [PendingModifiedServiceUpdate]
a} :: ClusterPendingUpdates) ((Maybe [PendingModifiedServiceUpdate]
  -> f (Maybe [PendingModifiedServiceUpdate]))
 -> ClusterPendingUpdates -> f ClusterPendingUpdates)
-> ((Maybe [PendingModifiedServiceUpdate]
     -> f (Maybe [PendingModifiedServiceUpdate]))
    -> Maybe [PendingModifiedServiceUpdate]
    -> f (Maybe [PendingModifiedServiceUpdate]))
-> (Maybe [PendingModifiedServiceUpdate]
    -> f (Maybe [PendingModifiedServiceUpdate]))
-> ClusterPendingUpdates
-> f ClusterPendingUpdates
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PendingModifiedServiceUpdate]
  [PendingModifiedServiceUpdate]
  [PendingModifiedServiceUpdate]
  [PendingModifiedServiceUpdate]
-> Iso
     (Maybe [PendingModifiedServiceUpdate])
     (Maybe [PendingModifiedServiceUpdate])
     (Maybe [PendingModifiedServiceUpdate])
     (Maybe [PendingModifiedServiceUpdate])
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
  [PendingModifiedServiceUpdate]
  [PendingModifiedServiceUpdate]
  [PendingModifiedServiceUpdate]
  [PendingModifiedServiceUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The status of an online resharding operation.
clusterPendingUpdates_resharding :: Lens.Lens' ClusterPendingUpdates (Prelude.Maybe ReshardingStatus)
clusterPendingUpdates_resharding :: (Maybe ReshardingStatus -> f (Maybe ReshardingStatus))
-> ClusterPendingUpdates -> f ClusterPendingUpdates
clusterPendingUpdates_resharding = (ClusterPendingUpdates -> Maybe ReshardingStatus)
-> (ClusterPendingUpdates
    -> Maybe ReshardingStatus -> ClusterPendingUpdates)
-> Lens
     ClusterPendingUpdates
     ClusterPendingUpdates
     (Maybe ReshardingStatus)
     (Maybe ReshardingStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterPendingUpdates' {Maybe ReshardingStatus
resharding :: Maybe ReshardingStatus
$sel:resharding:ClusterPendingUpdates' :: ClusterPendingUpdates -> Maybe ReshardingStatus
resharding} -> Maybe ReshardingStatus
resharding) (\s :: ClusterPendingUpdates
s@ClusterPendingUpdates' {} Maybe ReshardingStatus
a -> ClusterPendingUpdates
s {$sel:resharding:ClusterPendingUpdates' :: Maybe ReshardingStatus
resharding = Maybe ReshardingStatus
a} :: ClusterPendingUpdates)

-- | A list of ACLs associated with the cluster that are being updated
clusterPendingUpdates_aCLs :: Lens.Lens' ClusterPendingUpdates (Prelude.Maybe ACLsUpdateStatus)
clusterPendingUpdates_aCLs :: (Maybe ACLsUpdateStatus -> f (Maybe ACLsUpdateStatus))
-> ClusterPendingUpdates -> f ClusterPendingUpdates
clusterPendingUpdates_aCLs = (ClusterPendingUpdates -> Maybe ACLsUpdateStatus)
-> (ClusterPendingUpdates
    -> Maybe ACLsUpdateStatus -> ClusterPendingUpdates)
-> Lens
     ClusterPendingUpdates
     ClusterPendingUpdates
     (Maybe ACLsUpdateStatus)
     (Maybe ACLsUpdateStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterPendingUpdates' {Maybe ACLsUpdateStatus
aCLs :: Maybe ACLsUpdateStatus
$sel:aCLs:ClusterPendingUpdates' :: ClusterPendingUpdates -> Maybe ACLsUpdateStatus
aCLs} -> Maybe ACLsUpdateStatus
aCLs) (\s :: ClusterPendingUpdates
s@ClusterPendingUpdates' {} Maybe ACLsUpdateStatus
a -> ClusterPendingUpdates
s {$sel:aCLs:ClusterPendingUpdates' :: Maybe ACLsUpdateStatus
aCLs = Maybe ACLsUpdateStatus
a} :: ClusterPendingUpdates)

instance Core.FromJSON ClusterPendingUpdates where
  parseJSON :: Value -> Parser ClusterPendingUpdates
parseJSON =
    String
-> (Object -> Parser ClusterPendingUpdates)
-> Value
-> Parser ClusterPendingUpdates
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ClusterPendingUpdates"
      ( \Object
x ->
          Maybe [PendingModifiedServiceUpdate]
-> Maybe ReshardingStatus
-> Maybe ACLsUpdateStatus
-> ClusterPendingUpdates
ClusterPendingUpdates'
            (Maybe [PendingModifiedServiceUpdate]
 -> Maybe ReshardingStatus
 -> Maybe ACLsUpdateStatus
 -> ClusterPendingUpdates)
-> Parser (Maybe [PendingModifiedServiceUpdate])
-> Parser
     (Maybe ReshardingStatus
      -> Maybe ACLsUpdateStatus -> ClusterPendingUpdates)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [PendingModifiedServiceUpdate]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ServiceUpdates" Parser (Maybe (Maybe [PendingModifiedServiceUpdate]))
-> Maybe [PendingModifiedServiceUpdate]
-> Parser (Maybe [PendingModifiedServiceUpdate])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PendingModifiedServiceUpdate]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe ReshardingStatus
   -> Maybe ACLsUpdateStatus -> ClusterPendingUpdates)
-> Parser (Maybe ReshardingStatus)
-> Parser (Maybe ACLsUpdateStatus -> ClusterPendingUpdates)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReshardingStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Resharding")
            Parser (Maybe ACLsUpdateStatus -> ClusterPendingUpdates)
-> Parser (Maybe ACLsUpdateStatus) -> Parser ClusterPendingUpdates
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ACLsUpdateStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ACLs")
      )

instance Prelude.Hashable ClusterPendingUpdates

instance Prelude.NFData ClusterPendingUpdates