{-# 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.AutoScaling.Types.InstanceRefreshLivePoolProgress
-- 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.AutoScaling.Types.InstanceRefreshLivePoolProgress where

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

-- | Reports the progress of an instance refresh on instances that are in the
-- Auto Scaling group.
--
-- /See:/ 'newInstanceRefreshLivePoolProgress' smart constructor.
data InstanceRefreshLivePoolProgress = InstanceRefreshLivePoolProgress'
  { -- | The number of instances remaining to update.
    InstanceRefreshLivePoolProgress -> Maybe Natural
instancesToUpdate :: Prelude.Maybe Prelude.Natural,
    -- | The percentage of instances in the Auto Scaling group that have been
    -- replaced. For each instance replacement, Amazon EC2 Auto Scaling tracks
    -- the instance\'s health status and warm-up time. When the instance\'s
    -- health status changes to healthy and the specified warm-up time passes,
    -- the instance is considered updated and is added to the percentage
    -- complete.
    InstanceRefreshLivePoolProgress -> Maybe Natural
percentageComplete :: Prelude.Maybe Prelude.Natural
  }
  deriving (InstanceRefreshLivePoolProgress
-> InstanceRefreshLivePoolProgress -> Bool
(InstanceRefreshLivePoolProgress
 -> InstanceRefreshLivePoolProgress -> Bool)
-> (InstanceRefreshLivePoolProgress
    -> InstanceRefreshLivePoolProgress -> Bool)
-> Eq InstanceRefreshLivePoolProgress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceRefreshLivePoolProgress
-> InstanceRefreshLivePoolProgress -> Bool
$c/= :: InstanceRefreshLivePoolProgress
-> InstanceRefreshLivePoolProgress -> Bool
== :: InstanceRefreshLivePoolProgress
-> InstanceRefreshLivePoolProgress -> Bool
$c== :: InstanceRefreshLivePoolProgress
-> InstanceRefreshLivePoolProgress -> Bool
Prelude.Eq, ReadPrec [InstanceRefreshLivePoolProgress]
ReadPrec InstanceRefreshLivePoolProgress
Int -> ReadS InstanceRefreshLivePoolProgress
ReadS [InstanceRefreshLivePoolProgress]
(Int -> ReadS InstanceRefreshLivePoolProgress)
-> ReadS [InstanceRefreshLivePoolProgress]
-> ReadPrec InstanceRefreshLivePoolProgress
-> ReadPrec [InstanceRefreshLivePoolProgress]
-> Read InstanceRefreshLivePoolProgress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceRefreshLivePoolProgress]
$creadListPrec :: ReadPrec [InstanceRefreshLivePoolProgress]
readPrec :: ReadPrec InstanceRefreshLivePoolProgress
$creadPrec :: ReadPrec InstanceRefreshLivePoolProgress
readList :: ReadS [InstanceRefreshLivePoolProgress]
$creadList :: ReadS [InstanceRefreshLivePoolProgress]
readsPrec :: Int -> ReadS InstanceRefreshLivePoolProgress
$creadsPrec :: Int -> ReadS InstanceRefreshLivePoolProgress
Prelude.Read, Int -> InstanceRefreshLivePoolProgress -> ShowS
[InstanceRefreshLivePoolProgress] -> ShowS
InstanceRefreshLivePoolProgress -> String
(Int -> InstanceRefreshLivePoolProgress -> ShowS)
-> (InstanceRefreshLivePoolProgress -> String)
-> ([InstanceRefreshLivePoolProgress] -> ShowS)
-> Show InstanceRefreshLivePoolProgress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceRefreshLivePoolProgress] -> ShowS
$cshowList :: [InstanceRefreshLivePoolProgress] -> ShowS
show :: InstanceRefreshLivePoolProgress -> String
$cshow :: InstanceRefreshLivePoolProgress -> String
showsPrec :: Int -> InstanceRefreshLivePoolProgress -> ShowS
$cshowsPrec :: Int -> InstanceRefreshLivePoolProgress -> ShowS
Prelude.Show, (forall x.
 InstanceRefreshLivePoolProgress
 -> Rep InstanceRefreshLivePoolProgress x)
-> (forall x.
    Rep InstanceRefreshLivePoolProgress x
    -> InstanceRefreshLivePoolProgress)
-> Generic InstanceRefreshLivePoolProgress
forall x.
Rep InstanceRefreshLivePoolProgress x
-> InstanceRefreshLivePoolProgress
forall x.
InstanceRefreshLivePoolProgress
-> Rep InstanceRefreshLivePoolProgress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceRefreshLivePoolProgress x
-> InstanceRefreshLivePoolProgress
$cfrom :: forall x.
InstanceRefreshLivePoolProgress
-> Rep InstanceRefreshLivePoolProgress x
Prelude.Generic)

-- |
-- Create a value of 'InstanceRefreshLivePoolProgress' 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:
--
-- 'instancesToUpdate', 'instanceRefreshLivePoolProgress_instancesToUpdate' - The number of instances remaining to update.
--
-- 'percentageComplete', 'instanceRefreshLivePoolProgress_percentageComplete' - The percentage of instances in the Auto Scaling group that have been
-- replaced. For each instance replacement, Amazon EC2 Auto Scaling tracks
-- the instance\'s health status and warm-up time. When the instance\'s
-- health status changes to healthy and the specified warm-up time passes,
-- the instance is considered updated and is added to the percentage
-- complete.
newInstanceRefreshLivePoolProgress ::
  InstanceRefreshLivePoolProgress
newInstanceRefreshLivePoolProgress :: InstanceRefreshLivePoolProgress
newInstanceRefreshLivePoolProgress =
  InstanceRefreshLivePoolProgress' :: Maybe Natural -> Maybe Natural -> InstanceRefreshLivePoolProgress
InstanceRefreshLivePoolProgress'
    { $sel:instancesToUpdate:InstanceRefreshLivePoolProgress' :: Maybe Natural
instancesToUpdate =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:percentageComplete:InstanceRefreshLivePoolProgress' :: Maybe Natural
percentageComplete = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of instances remaining to update.
instanceRefreshLivePoolProgress_instancesToUpdate :: Lens.Lens' InstanceRefreshLivePoolProgress (Prelude.Maybe Prelude.Natural)
instanceRefreshLivePoolProgress_instancesToUpdate :: (Maybe Natural -> f (Maybe Natural))
-> InstanceRefreshLivePoolProgress
-> f InstanceRefreshLivePoolProgress
instanceRefreshLivePoolProgress_instancesToUpdate = (InstanceRefreshLivePoolProgress -> Maybe Natural)
-> (InstanceRefreshLivePoolProgress
    -> Maybe Natural -> InstanceRefreshLivePoolProgress)
-> Lens
     InstanceRefreshLivePoolProgress
     InstanceRefreshLivePoolProgress
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceRefreshLivePoolProgress' {Maybe Natural
instancesToUpdate :: Maybe Natural
$sel:instancesToUpdate:InstanceRefreshLivePoolProgress' :: InstanceRefreshLivePoolProgress -> Maybe Natural
instancesToUpdate} -> Maybe Natural
instancesToUpdate) (\s :: InstanceRefreshLivePoolProgress
s@InstanceRefreshLivePoolProgress' {} Maybe Natural
a -> InstanceRefreshLivePoolProgress
s {$sel:instancesToUpdate:InstanceRefreshLivePoolProgress' :: Maybe Natural
instancesToUpdate = Maybe Natural
a} :: InstanceRefreshLivePoolProgress)

-- | The percentage of instances in the Auto Scaling group that have been
-- replaced. For each instance replacement, Amazon EC2 Auto Scaling tracks
-- the instance\'s health status and warm-up time. When the instance\'s
-- health status changes to healthy and the specified warm-up time passes,
-- the instance is considered updated and is added to the percentage
-- complete.
instanceRefreshLivePoolProgress_percentageComplete :: Lens.Lens' InstanceRefreshLivePoolProgress (Prelude.Maybe Prelude.Natural)
instanceRefreshLivePoolProgress_percentageComplete :: (Maybe Natural -> f (Maybe Natural))
-> InstanceRefreshLivePoolProgress
-> f InstanceRefreshLivePoolProgress
instanceRefreshLivePoolProgress_percentageComplete = (InstanceRefreshLivePoolProgress -> Maybe Natural)
-> (InstanceRefreshLivePoolProgress
    -> Maybe Natural -> InstanceRefreshLivePoolProgress)
-> Lens
     InstanceRefreshLivePoolProgress
     InstanceRefreshLivePoolProgress
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceRefreshLivePoolProgress' {Maybe Natural
percentageComplete :: Maybe Natural
$sel:percentageComplete:InstanceRefreshLivePoolProgress' :: InstanceRefreshLivePoolProgress -> Maybe Natural
percentageComplete} -> Maybe Natural
percentageComplete) (\s :: InstanceRefreshLivePoolProgress
s@InstanceRefreshLivePoolProgress' {} Maybe Natural
a -> InstanceRefreshLivePoolProgress
s {$sel:percentageComplete:InstanceRefreshLivePoolProgress' :: Maybe Natural
percentageComplete = Maybe Natural
a} :: InstanceRefreshLivePoolProgress)

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

instance
  Prelude.Hashable
    InstanceRefreshLivePoolProgress

instance
  Prelude.NFData
    InstanceRefreshLivePoolProgress