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

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

-- | The status of an online resharding operation.
--
-- /See:/ 'newReshardingStatus' smart constructor.
data ReshardingStatus = ReshardingStatus'
  { -- | Represents the progress of an online resharding operation.
    ReshardingStatus -> Maybe SlotMigration
slotMigration :: Prelude.Maybe SlotMigration
  }
  deriving (ReshardingStatus -> ReshardingStatus -> Bool
(ReshardingStatus -> ReshardingStatus -> Bool)
-> (ReshardingStatus -> ReshardingStatus -> Bool)
-> Eq ReshardingStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReshardingStatus -> ReshardingStatus -> Bool
$c/= :: ReshardingStatus -> ReshardingStatus -> Bool
== :: ReshardingStatus -> ReshardingStatus -> Bool
$c== :: ReshardingStatus -> ReshardingStatus -> Bool
Prelude.Eq, ReadPrec [ReshardingStatus]
ReadPrec ReshardingStatus
Int -> ReadS ReshardingStatus
ReadS [ReshardingStatus]
(Int -> ReadS ReshardingStatus)
-> ReadS [ReshardingStatus]
-> ReadPrec ReshardingStatus
-> ReadPrec [ReshardingStatus]
-> Read ReshardingStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReshardingStatus]
$creadListPrec :: ReadPrec [ReshardingStatus]
readPrec :: ReadPrec ReshardingStatus
$creadPrec :: ReadPrec ReshardingStatus
readList :: ReadS [ReshardingStatus]
$creadList :: ReadS [ReshardingStatus]
readsPrec :: Int -> ReadS ReshardingStatus
$creadsPrec :: Int -> ReadS ReshardingStatus
Prelude.Read, Int -> ReshardingStatus -> ShowS
[ReshardingStatus] -> ShowS
ReshardingStatus -> String
(Int -> ReshardingStatus -> ShowS)
-> (ReshardingStatus -> String)
-> ([ReshardingStatus] -> ShowS)
-> Show ReshardingStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReshardingStatus] -> ShowS
$cshowList :: [ReshardingStatus] -> ShowS
show :: ReshardingStatus -> String
$cshow :: ReshardingStatus -> String
showsPrec :: Int -> ReshardingStatus -> ShowS
$cshowsPrec :: Int -> ReshardingStatus -> ShowS
Prelude.Show, (forall x. ReshardingStatus -> Rep ReshardingStatus x)
-> (forall x. Rep ReshardingStatus x -> ReshardingStatus)
-> Generic ReshardingStatus
forall x. Rep ReshardingStatus x -> ReshardingStatus
forall x. ReshardingStatus -> Rep ReshardingStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReshardingStatus x -> ReshardingStatus
$cfrom :: forall x. ReshardingStatus -> Rep ReshardingStatus x
Prelude.Generic)

-- |
-- Create a value of 'ReshardingStatus' 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:
--
-- 'slotMigration', 'reshardingStatus_slotMigration' - Represents the progress of an online resharding operation.
newReshardingStatus ::
  ReshardingStatus
newReshardingStatus :: ReshardingStatus
newReshardingStatus =
  ReshardingStatus' :: Maybe SlotMigration -> ReshardingStatus
ReshardingStatus' {$sel:slotMigration:ReshardingStatus' :: Maybe SlotMigration
slotMigration = Maybe SlotMigration
forall a. Maybe a
Prelude.Nothing}

-- | Represents the progress of an online resharding operation.
reshardingStatus_slotMigration :: Lens.Lens' ReshardingStatus (Prelude.Maybe SlotMigration)
reshardingStatus_slotMigration :: (Maybe SlotMigration -> f (Maybe SlotMigration))
-> ReshardingStatus -> f ReshardingStatus
reshardingStatus_slotMigration = (ReshardingStatus -> Maybe SlotMigration)
-> (ReshardingStatus -> Maybe SlotMigration -> ReshardingStatus)
-> Lens
     ReshardingStatus
     ReshardingStatus
     (Maybe SlotMigration)
     (Maybe SlotMigration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReshardingStatus' {Maybe SlotMigration
slotMigration :: Maybe SlotMigration
$sel:slotMigration:ReshardingStatus' :: ReshardingStatus -> Maybe SlotMigration
slotMigration} -> Maybe SlotMigration
slotMigration) (\s :: ReshardingStatus
s@ReshardingStatus' {} Maybe SlotMigration
a -> ReshardingStatus
s {$sel:slotMigration:ReshardingStatus' :: Maybe SlotMigration
slotMigration = Maybe SlotMigration
a} :: ReshardingStatus)

instance Core.FromXML ReshardingStatus where
  parseXML :: [Node] -> Either String ReshardingStatus
parseXML [Node]
x =
    Maybe SlotMigration -> ReshardingStatus
ReshardingStatus'
      (Maybe SlotMigration -> ReshardingStatus)
-> Either String (Maybe SlotMigration)
-> Either String ReshardingStatus
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe SlotMigration)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SlotMigration")

instance Prelude.Hashable ReshardingStatus

instance Prelude.NFData ReshardingStatus