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

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

-- | The status of the online resharding
--
-- /See:/ 'newReshardingStatus' smart constructor.
data ReshardingStatus = ReshardingStatus'
  { -- | The status of the online resharding slot migration
    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' - The status of the online resharding slot migration
newReshardingStatus ::
  ReshardingStatus
newReshardingStatus :: ReshardingStatus
newReshardingStatus =
  ReshardingStatus' :: Maybe SlotMigration -> ReshardingStatus
ReshardingStatus' {$sel:slotMigration:ReshardingStatus' :: Maybe SlotMigration
slotMigration = Maybe SlotMigration
forall a. Maybe a
Prelude.Nothing}

-- | The status of the online resharding slot migration
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.FromJSON ReshardingStatus where
  parseJSON :: Value -> Parser ReshardingStatus
parseJSON =
    String
-> (Object -> Parser ReshardingStatus)
-> Value
-> Parser ReshardingStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReshardingStatus"
      ( \Object
x ->
          Maybe SlotMigration -> ReshardingStatus
ReshardingStatus'
            (Maybe SlotMigration -> ReshardingStatus)
-> Parser (Maybe SlotMigration) -> Parser ReshardingStatus
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SlotMigration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SlotMigration")
      )

instance Prelude.Hashable ReshardingStatus

instance Prelude.NFData ReshardingStatus