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

-- | Reports the progress of an instance refresh on instances that are in the
-- warm pool.
--
-- /See:/ 'newInstanceRefreshWarmPoolProgress' smart constructor.
data InstanceRefreshWarmPoolProgress = InstanceRefreshWarmPoolProgress'
  { -- | The number of instances remaining to update.
    InstanceRefreshWarmPoolProgress -> Maybe Natural
instancesToUpdate :: Prelude.Maybe Prelude.Natural,
    -- | The percentage of instances in the warm pool 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.
    InstanceRefreshWarmPoolProgress -> Maybe Natural
percentageComplete :: Prelude.Maybe Prelude.Natural
  }
  deriving (InstanceRefreshWarmPoolProgress
-> InstanceRefreshWarmPoolProgress -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceRefreshWarmPoolProgress
-> InstanceRefreshWarmPoolProgress -> Bool
$c/= :: InstanceRefreshWarmPoolProgress
-> InstanceRefreshWarmPoolProgress -> Bool
== :: InstanceRefreshWarmPoolProgress
-> InstanceRefreshWarmPoolProgress -> Bool
$c== :: InstanceRefreshWarmPoolProgress
-> InstanceRefreshWarmPoolProgress -> Bool
Prelude.Eq, ReadPrec [InstanceRefreshWarmPoolProgress]
ReadPrec InstanceRefreshWarmPoolProgress
Int -> ReadS InstanceRefreshWarmPoolProgress
ReadS [InstanceRefreshWarmPoolProgress]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceRefreshWarmPoolProgress]
$creadListPrec :: ReadPrec [InstanceRefreshWarmPoolProgress]
readPrec :: ReadPrec InstanceRefreshWarmPoolProgress
$creadPrec :: ReadPrec InstanceRefreshWarmPoolProgress
readList :: ReadS [InstanceRefreshWarmPoolProgress]
$creadList :: ReadS [InstanceRefreshWarmPoolProgress]
readsPrec :: Int -> ReadS InstanceRefreshWarmPoolProgress
$creadsPrec :: Int -> ReadS InstanceRefreshWarmPoolProgress
Prelude.Read, Int -> InstanceRefreshWarmPoolProgress -> ShowS
[InstanceRefreshWarmPoolProgress] -> ShowS
InstanceRefreshWarmPoolProgress -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceRefreshWarmPoolProgress] -> ShowS
$cshowList :: [InstanceRefreshWarmPoolProgress] -> ShowS
show :: InstanceRefreshWarmPoolProgress -> String
$cshow :: InstanceRefreshWarmPoolProgress -> String
showsPrec :: Int -> InstanceRefreshWarmPoolProgress -> ShowS
$cshowsPrec :: Int -> InstanceRefreshWarmPoolProgress -> ShowS
Prelude.Show, forall x.
Rep InstanceRefreshWarmPoolProgress x
-> InstanceRefreshWarmPoolProgress
forall x.
InstanceRefreshWarmPoolProgress
-> Rep InstanceRefreshWarmPoolProgress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceRefreshWarmPoolProgress x
-> InstanceRefreshWarmPoolProgress
$cfrom :: forall x.
InstanceRefreshWarmPoolProgress
-> Rep InstanceRefreshWarmPoolProgress x
Prelude.Generic)

-- |
-- Create a value of 'InstanceRefreshWarmPoolProgress' 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', 'instanceRefreshWarmPoolProgress_instancesToUpdate' - The number of instances remaining to update.
--
-- 'percentageComplete', 'instanceRefreshWarmPoolProgress_percentageComplete' - The percentage of instances in the warm pool 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.
newInstanceRefreshWarmPoolProgress ::
  InstanceRefreshWarmPoolProgress
newInstanceRefreshWarmPoolProgress :: InstanceRefreshWarmPoolProgress
newInstanceRefreshWarmPoolProgress =
  InstanceRefreshWarmPoolProgress'
    { $sel:instancesToUpdate:InstanceRefreshWarmPoolProgress' :: Maybe Natural
instancesToUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:percentageComplete:InstanceRefreshWarmPoolProgress' :: Maybe Natural
percentageComplete = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The percentage of instances in the warm pool 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.
instanceRefreshWarmPoolProgress_percentageComplete :: Lens.Lens' InstanceRefreshWarmPoolProgress (Prelude.Maybe Prelude.Natural)
instanceRefreshWarmPoolProgress_percentageComplete :: Lens' InstanceRefreshWarmPoolProgress (Maybe Natural)
instanceRefreshWarmPoolProgress_percentageComplete = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceRefreshWarmPoolProgress' {Maybe Natural
percentageComplete :: Maybe Natural
$sel:percentageComplete:InstanceRefreshWarmPoolProgress' :: InstanceRefreshWarmPoolProgress -> Maybe Natural
percentageComplete} -> Maybe Natural
percentageComplete) (\s :: InstanceRefreshWarmPoolProgress
s@InstanceRefreshWarmPoolProgress' {} Maybe Natural
a -> InstanceRefreshWarmPoolProgress
s {$sel:percentageComplete:InstanceRefreshWarmPoolProgress' :: Maybe Natural
percentageComplete = Maybe Natural
a} :: InstanceRefreshWarmPoolProgress)

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

instance
  Prelude.Hashable
    InstanceRefreshWarmPoolProgress
  where
  hashWithSalt :: Int -> InstanceRefreshWarmPoolProgress -> Int
hashWithSalt
    Int
_salt
    InstanceRefreshWarmPoolProgress' {Maybe Natural
percentageComplete :: Maybe Natural
instancesToUpdate :: Maybe Natural
$sel:percentageComplete:InstanceRefreshWarmPoolProgress' :: InstanceRefreshWarmPoolProgress -> Maybe Natural
$sel:instancesToUpdate:InstanceRefreshWarmPoolProgress' :: InstanceRefreshWarmPoolProgress -> Maybe Natural
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
instancesToUpdate
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
percentageComplete

instance
  Prelude.NFData
    InstanceRefreshWarmPoolProgress
  where
  rnf :: InstanceRefreshWarmPoolProgress -> ()
rnf InstanceRefreshWarmPoolProgress' {Maybe Natural
percentageComplete :: Maybe Natural
instancesToUpdate :: Maybe Natural
$sel:percentageComplete:InstanceRefreshWarmPoolProgress' :: InstanceRefreshWarmPoolProgress -> Maybe Natural
$sel:instancesToUpdate:InstanceRefreshWarmPoolProgress' :: InstanceRefreshWarmPoolProgress -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
instancesToUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
percentageComplete