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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(SlotMigration -> SlotMigration -> Bool)
-> (SlotMigration -> SlotMigration -> Bool) -> Eq SlotMigration
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]
(Int -> ReadS SlotMigration)
-> ReadS [SlotMigration]
-> ReadPrec SlotMigration
-> ReadPrec [SlotMigration]
-> Read 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
(Int -> SlotMigration -> ShowS)
-> (SlotMigration -> String)
-> ([SlotMigration] -> ShowS)
-> Show SlotMigration
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. SlotMigration -> Rep SlotMigration x)
-> (forall x. Rep SlotMigration x -> SlotMigration)
-> Generic SlotMigration
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' :: Maybe Double -> SlotMigration
SlotMigration'
    { $sel:progressPercentage:SlotMigration' :: Maybe Double
progressPercentage =
        Maybe Double
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 :: (Maybe Double -> f (Maybe Double))
-> SlotMigration -> f SlotMigration
slotMigration_progressPercentage = (SlotMigration -> Maybe Double)
-> (SlotMigration -> Maybe Double -> SlotMigration)
-> Lens SlotMigration SlotMigration (Maybe Double) (Maybe Double)
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 Core.FromJSON SlotMigration where
  parseJSON :: Value -> Parser SlotMigration
parseJSON =
    String
-> (Object -> Parser SlotMigration)
-> Value
-> Parser SlotMigration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SlotMigration"
      ( \Object
x ->
          Maybe Double -> SlotMigration
SlotMigration'
            (Maybe Double -> SlotMigration)
-> Parser (Maybe Double) -> Parser SlotMigration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProgressPercentage")
      )

instance Prelude.Hashable SlotMigration

instance Prelude.NFData SlotMigration