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

import Amazonka.AutoScaling.Types.InstanceRefreshLivePoolProgress
import Amazonka.AutoScaling.Types.InstanceRefreshWarmPoolProgress
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 an Auto Scaling group
-- that has a warm pool. This includes separate details for instances in
-- the warm pool and instances in the Auto Scaling group (the live pool).
--
-- /See:/ 'newInstanceRefreshProgressDetails' smart constructor.
data InstanceRefreshProgressDetails = InstanceRefreshProgressDetails'
  { -- | Indicates the progress of an instance refresh on instances that are in
    -- the Auto Scaling group.
    InstanceRefreshProgressDetails
-> Maybe InstanceRefreshLivePoolProgress
livePoolProgress :: Prelude.Maybe InstanceRefreshLivePoolProgress,
    -- | Indicates the progress of an instance refresh on instances that are in
    -- the warm pool.
    InstanceRefreshProgressDetails
-> Maybe InstanceRefreshWarmPoolProgress
warmPoolProgress :: Prelude.Maybe InstanceRefreshWarmPoolProgress
  }
  deriving (InstanceRefreshProgressDetails
-> InstanceRefreshProgressDetails -> Bool
(InstanceRefreshProgressDetails
 -> InstanceRefreshProgressDetails -> Bool)
-> (InstanceRefreshProgressDetails
    -> InstanceRefreshProgressDetails -> Bool)
-> Eq InstanceRefreshProgressDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceRefreshProgressDetails
-> InstanceRefreshProgressDetails -> Bool
$c/= :: InstanceRefreshProgressDetails
-> InstanceRefreshProgressDetails -> Bool
== :: InstanceRefreshProgressDetails
-> InstanceRefreshProgressDetails -> Bool
$c== :: InstanceRefreshProgressDetails
-> InstanceRefreshProgressDetails -> Bool
Prelude.Eq, ReadPrec [InstanceRefreshProgressDetails]
ReadPrec InstanceRefreshProgressDetails
Int -> ReadS InstanceRefreshProgressDetails
ReadS [InstanceRefreshProgressDetails]
(Int -> ReadS InstanceRefreshProgressDetails)
-> ReadS [InstanceRefreshProgressDetails]
-> ReadPrec InstanceRefreshProgressDetails
-> ReadPrec [InstanceRefreshProgressDetails]
-> Read InstanceRefreshProgressDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceRefreshProgressDetails]
$creadListPrec :: ReadPrec [InstanceRefreshProgressDetails]
readPrec :: ReadPrec InstanceRefreshProgressDetails
$creadPrec :: ReadPrec InstanceRefreshProgressDetails
readList :: ReadS [InstanceRefreshProgressDetails]
$creadList :: ReadS [InstanceRefreshProgressDetails]
readsPrec :: Int -> ReadS InstanceRefreshProgressDetails
$creadsPrec :: Int -> ReadS InstanceRefreshProgressDetails
Prelude.Read, Int -> InstanceRefreshProgressDetails -> ShowS
[InstanceRefreshProgressDetails] -> ShowS
InstanceRefreshProgressDetails -> String
(Int -> InstanceRefreshProgressDetails -> ShowS)
-> (InstanceRefreshProgressDetails -> String)
-> ([InstanceRefreshProgressDetails] -> ShowS)
-> Show InstanceRefreshProgressDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceRefreshProgressDetails] -> ShowS
$cshowList :: [InstanceRefreshProgressDetails] -> ShowS
show :: InstanceRefreshProgressDetails -> String
$cshow :: InstanceRefreshProgressDetails -> String
showsPrec :: Int -> InstanceRefreshProgressDetails -> ShowS
$cshowsPrec :: Int -> InstanceRefreshProgressDetails -> ShowS
Prelude.Show, (forall x.
 InstanceRefreshProgressDetails
 -> Rep InstanceRefreshProgressDetails x)
-> (forall x.
    Rep InstanceRefreshProgressDetails x
    -> InstanceRefreshProgressDetails)
-> Generic InstanceRefreshProgressDetails
forall x.
Rep InstanceRefreshProgressDetails x
-> InstanceRefreshProgressDetails
forall x.
InstanceRefreshProgressDetails
-> Rep InstanceRefreshProgressDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceRefreshProgressDetails x
-> InstanceRefreshProgressDetails
$cfrom :: forall x.
InstanceRefreshProgressDetails
-> Rep InstanceRefreshProgressDetails x
Prelude.Generic)

-- |
-- Create a value of 'InstanceRefreshProgressDetails' 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:
--
-- 'livePoolProgress', 'instanceRefreshProgressDetails_livePoolProgress' - Indicates the progress of an instance refresh on instances that are in
-- the Auto Scaling group.
--
-- 'warmPoolProgress', 'instanceRefreshProgressDetails_warmPoolProgress' - Indicates the progress of an instance refresh on instances that are in
-- the warm pool.
newInstanceRefreshProgressDetails ::
  InstanceRefreshProgressDetails
newInstanceRefreshProgressDetails :: InstanceRefreshProgressDetails
newInstanceRefreshProgressDetails =
  InstanceRefreshProgressDetails' :: Maybe InstanceRefreshLivePoolProgress
-> Maybe InstanceRefreshWarmPoolProgress
-> InstanceRefreshProgressDetails
InstanceRefreshProgressDetails'
    { $sel:livePoolProgress:InstanceRefreshProgressDetails' :: Maybe InstanceRefreshLivePoolProgress
livePoolProgress =
        Maybe InstanceRefreshLivePoolProgress
forall a. Maybe a
Prelude.Nothing,
      $sel:warmPoolProgress:InstanceRefreshProgressDetails' :: Maybe InstanceRefreshWarmPoolProgress
warmPoolProgress = Maybe InstanceRefreshWarmPoolProgress
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates the progress of an instance refresh on instances that are in
-- the Auto Scaling group.
instanceRefreshProgressDetails_livePoolProgress :: Lens.Lens' InstanceRefreshProgressDetails (Prelude.Maybe InstanceRefreshLivePoolProgress)
instanceRefreshProgressDetails_livePoolProgress :: (Maybe InstanceRefreshLivePoolProgress
 -> f (Maybe InstanceRefreshLivePoolProgress))
-> InstanceRefreshProgressDetails
-> f InstanceRefreshProgressDetails
instanceRefreshProgressDetails_livePoolProgress = (InstanceRefreshProgressDetails
 -> Maybe InstanceRefreshLivePoolProgress)
-> (InstanceRefreshProgressDetails
    -> Maybe InstanceRefreshLivePoolProgress
    -> InstanceRefreshProgressDetails)
-> Lens
     InstanceRefreshProgressDetails
     InstanceRefreshProgressDetails
     (Maybe InstanceRefreshLivePoolProgress)
     (Maybe InstanceRefreshLivePoolProgress)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceRefreshProgressDetails' {Maybe InstanceRefreshLivePoolProgress
livePoolProgress :: Maybe InstanceRefreshLivePoolProgress
$sel:livePoolProgress:InstanceRefreshProgressDetails' :: InstanceRefreshProgressDetails
-> Maybe InstanceRefreshLivePoolProgress
livePoolProgress} -> Maybe InstanceRefreshLivePoolProgress
livePoolProgress) (\s :: InstanceRefreshProgressDetails
s@InstanceRefreshProgressDetails' {} Maybe InstanceRefreshLivePoolProgress
a -> InstanceRefreshProgressDetails
s {$sel:livePoolProgress:InstanceRefreshProgressDetails' :: Maybe InstanceRefreshLivePoolProgress
livePoolProgress = Maybe InstanceRefreshLivePoolProgress
a} :: InstanceRefreshProgressDetails)

-- | Indicates the progress of an instance refresh on instances that are in
-- the warm pool.
instanceRefreshProgressDetails_warmPoolProgress :: Lens.Lens' InstanceRefreshProgressDetails (Prelude.Maybe InstanceRefreshWarmPoolProgress)
instanceRefreshProgressDetails_warmPoolProgress :: (Maybe InstanceRefreshWarmPoolProgress
 -> f (Maybe InstanceRefreshWarmPoolProgress))
-> InstanceRefreshProgressDetails
-> f InstanceRefreshProgressDetails
instanceRefreshProgressDetails_warmPoolProgress = (InstanceRefreshProgressDetails
 -> Maybe InstanceRefreshWarmPoolProgress)
-> (InstanceRefreshProgressDetails
    -> Maybe InstanceRefreshWarmPoolProgress
    -> InstanceRefreshProgressDetails)
-> Lens
     InstanceRefreshProgressDetails
     InstanceRefreshProgressDetails
     (Maybe InstanceRefreshWarmPoolProgress)
     (Maybe InstanceRefreshWarmPoolProgress)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceRefreshProgressDetails' {Maybe InstanceRefreshWarmPoolProgress
warmPoolProgress :: Maybe InstanceRefreshWarmPoolProgress
$sel:warmPoolProgress:InstanceRefreshProgressDetails' :: InstanceRefreshProgressDetails
-> Maybe InstanceRefreshWarmPoolProgress
warmPoolProgress} -> Maybe InstanceRefreshWarmPoolProgress
warmPoolProgress) (\s :: InstanceRefreshProgressDetails
s@InstanceRefreshProgressDetails' {} Maybe InstanceRefreshWarmPoolProgress
a -> InstanceRefreshProgressDetails
s {$sel:warmPoolProgress:InstanceRefreshProgressDetails' :: Maybe InstanceRefreshWarmPoolProgress
warmPoolProgress = Maybe InstanceRefreshWarmPoolProgress
a} :: InstanceRefreshProgressDetails)

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

instance
  Prelude.Hashable
    InstanceRefreshProgressDetails

instance
  Prelude.NFData
    InstanceRefreshProgressDetails