{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MemoryDb.Types.ReshardingStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:slotMigration:ReshardingStatus' :: Maybe SlotMigration
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 :: Lens' ReshardingStatus (Maybe SlotMigration)
reshardingStatus_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 Data.FromJSON ReshardingStatus where
  parseJSON :: Value -> Parser ReshardingStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReshardingStatus"
      ( \Object
x ->
          Maybe SlotMigration -> ReshardingStatus
ReshardingStatus'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SlotMigration")
      )

instance Prelude.Hashable ReshardingStatus where
  hashWithSalt :: Int -> ReshardingStatus -> Int
hashWithSalt Int
_salt ReshardingStatus' {Maybe SlotMigration
slotMigration :: Maybe SlotMigration
$sel:slotMigration:ReshardingStatus' :: ReshardingStatus -> Maybe SlotMigration
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SlotMigration
slotMigration

instance Prelude.NFData ReshardingStatus where
  rnf :: ReshardingStatus -> ()
rnf ReshardingStatus' {Maybe SlotMigration
slotMigration :: Maybe SlotMigration
$sel:slotMigration:ReshardingStatus' :: ReshardingStatus -> Maybe SlotMigration
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe SlotMigration
slotMigration