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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'SlotMigration' 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:
--
-- 'progressPercentage', 'slotMigration_progressPercentage' - The percentage of the slot migration that is complete.
newSlotMigration ::
  SlotMigration
newSlotMigration :: SlotMigration
newSlotMigration =
  SlotMigration'
    { $sel:progressPercentage:SlotMigration' :: Maybe Double
progressPercentage =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The percentage of the slot migration that is complete.
slotMigration_progressPercentage :: Lens.Lens' SlotMigration (Prelude.Maybe Prelude.Double)
slotMigration_progressPercentage :: Lens' SlotMigration (Maybe Double)
slotMigration_progressPercentage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlotMigration' {Maybe Double
progressPercentage :: Maybe Double
$sel:progressPercentage:SlotMigration' :: SlotMigration -> Maybe Double
progressPercentage} -> Maybe Double
progressPercentage) (\s :: SlotMigration
s@SlotMigration' {} Maybe Double
a -> SlotMigration
s {$sel:progressPercentage:SlotMigration' :: Maybe Double
progressPercentage = Maybe Double
a} :: SlotMigration)

instance Data.FromJSON SlotMigration where
  parseJSON :: Value -> Parser SlotMigration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SlotMigration"
      ( \Object
x ->
          Maybe Double -> SlotMigration
SlotMigration'
            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
"ProgressPercentage")
      )

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

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