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

import Amazonka.AutoScaling.Types.LaunchTemplateSpecification
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes an EC2 instance associated with an Auto Scaling group.
--
-- /See:/ 'newAutoScalingInstanceDetails' smart constructor.
data AutoScalingInstanceDetails = AutoScalingInstanceDetails'
  { -- | The number of capacity units contributed by the instance based on its
    -- instance type.
    --
    -- Valid Range: Minimum value of 1. Maximum value of 999.
    AutoScalingInstanceDetails -> Maybe Text
weightedCapacity :: Prelude.Maybe Prelude.Text,
    -- | The instance type of the EC2 instance.
    AutoScalingInstanceDetails -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | The launch configuration used to launch the instance. This value is not
    -- available if you attached the instance to the Auto Scaling group.
    AutoScalingInstanceDetails -> Maybe Text
launchConfigurationName :: Prelude.Maybe Prelude.Text,
    -- | The launch template for the instance.
    AutoScalingInstanceDetails -> Maybe LaunchTemplateSpecification
launchTemplate :: Prelude.Maybe LaunchTemplateSpecification,
    -- | The ID of the instance.
    AutoScalingInstanceDetails -> Text
instanceId :: Prelude.Text,
    -- | The name of the Auto Scaling group for the instance.
    AutoScalingInstanceDetails -> Text
autoScalingGroupName :: Prelude.Text,
    -- | The Availability Zone for the instance.
    AutoScalingInstanceDetails -> Text
availabilityZone :: Prelude.Text,
    -- | The lifecycle state for the instance. The @Quarantined@ state is not
    -- used. For information about lifecycle states, see
    -- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroupLifecycle.html Instance lifecycle>
    -- in the /Amazon EC2 Auto Scaling User Guide/.
    --
    -- Valid Values: @Pending@ | @Pending:Wait@ | @Pending:Proceed@ |
    -- @Quarantined@ | @InService@ | @Terminating@ | @Terminating:Wait@ |
    -- @Terminating:Proceed@ | @Terminated@ | @Detaching@ | @Detached@ |
    -- @EnteringStandby@ | @Standby@ | @Warmed:Pending@ | @Warmed:Pending:Wait@
    -- | @Warmed:Pending:Proceed@ | @Warmed:Terminating@ |
    -- @Warmed:Terminating:Wait@ | @Warmed:Terminating:Proceed@ |
    -- @Warmed:Terminated@ | @Warmed:Stopped@ | @Warmed:Running@
    AutoScalingInstanceDetails -> Text
lifecycleState :: Prelude.Text,
    -- | The last reported health status of this instance. \"Healthy\" means that
    -- the instance is healthy and should remain in service. \"Unhealthy\"
    -- means that the instance is unhealthy and Amazon EC2 Auto Scaling should
    -- terminate and replace it.
    AutoScalingInstanceDetails -> Text
healthStatus :: Prelude.Text,
    -- | Indicates whether the instance is protected from termination by Amazon
    -- EC2 Auto Scaling when scaling in.
    AutoScalingInstanceDetails -> Bool
protectedFromScaleIn :: Prelude.Bool
  }
  deriving (AutoScalingInstanceDetails -> AutoScalingInstanceDetails -> Bool
(AutoScalingInstanceDetails -> AutoScalingInstanceDetails -> Bool)
-> (AutoScalingInstanceDetails
    -> AutoScalingInstanceDetails -> Bool)
-> Eq AutoScalingInstanceDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoScalingInstanceDetails -> AutoScalingInstanceDetails -> Bool
$c/= :: AutoScalingInstanceDetails -> AutoScalingInstanceDetails -> Bool
== :: AutoScalingInstanceDetails -> AutoScalingInstanceDetails -> Bool
$c== :: AutoScalingInstanceDetails -> AutoScalingInstanceDetails -> Bool
Prelude.Eq, ReadPrec [AutoScalingInstanceDetails]
ReadPrec AutoScalingInstanceDetails
Int -> ReadS AutoScalingInstanceDetails
ReadS [AutoScalingInstanceDetails]
(Int -> ReadS AutoScalingInstanceDetails)
-> ReadS [AutoScalingInstanceDetails]
-> ReadPrec AutoScalingInstanceDetails
-> ReadPrec [AutoScalingInstanceDetails]
-> Read AutoScalingInstanceDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoScalingInstanceDetails]
$creadListPrec :: ReadPrec [AutoScalingInstanceDetails]
readPrec :: ReadPrec AutoScalingInstanceDetails
$creadPrec :: ReadPrec AutoScalingInstanceDetails
readList :: ReadS [AutoScalingInstanceDetails]
$creadList :: ReadS [AutoScalingInstanceDetails]
readsPrec :: Int -> ReadS AutoScalingInstanceDetails
$creadsPrec :: Int -> ReadS AutoScalingInstanceDetails
Prelude.Read, Int -> AutoScalingInstanceDetails -> ShowS
[AutoScalingInstanceDetails] -> ShowS
AutoScalingInstanceDetails -> String
(Int -> AutoScalingInstanceDetails -> ShowS)
-> (AutoScalingInstanceDetails -> String)
-> ([AutoScalingInstanceDetails] -> ShowS)
-> Show AutoScalingInstanceDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoScalingInstanceDetails] -> ShowS
$cshowList :: [AutoScalingInstanceDetails] -> ShowS
show :: AutoScalingInstanceDetails -> String
$cshow :: AutoScalingInstanceDetails -> String
showsPrec :: Int -> AutoScalingInstanceDetails -> ShowS
$cshowsPrec :: Int -> AutoScalingInstanceDetails -> ShowS
Prelude.Show, (forall x.
 AutoScalingInstanceDetails -> Rep AutoScalingInstanceDetails x)
-> (forall x.
    Rep AutoScalingInstanceDetails x -> AutoScalingInstanceDetails)
-> Generic AutoScalingInstanceDetails
forall x.
Rep AutoScalingInstanceDetails x -> AutoScalingInstanceDetails
forall x.
AutoScalingInstanceDetails -> Rep AutoScalingInstanceDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutoScalingInstanceDetails x -> AutoScalingInstanceDetails
$cfrom :: forall x.
AutoScalingInstanceDetails -> Rep AutoScalingInstanceDetails x
Prelude.Generic)

-- |
-- Create a value of 'AutoScalingInstanceDetails' 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:
--
-- 'weightedCapacity', 'autoScalingInstanceDetails_weightedCapacity' - The number of capacity units contributed by the instance based on its
-- instance type.
--
-- Valid Range: Minimum value of 1. Maximum value of 999.
--
-- 'instanceType', 'autoScalingInstanceDetails_instanceType' - The instance type of the EC2 instance.
--
-- 'launchConfigurationName', 'autoScalingInstanceDetails_launchConfigurationName' - The launch configuration used to launch the instance. This value is not
-- available if you attached the instance to the Auto Scaling group.
--
-- 'launchTemplate', 'autoScalingInstanceDetails_launchTemplate' - The launch template for the instance.
--
-- 'instanceId', 'autoScalingInstanceDetails_instanceId' - The ID of the instance.
--
-- 'autoScalingGroupName', 'autoScalingInstanceDetails_autoScalingGroupName' - The name of the Auto Scaling group for the instance.
--
-- 'availabilityZone', 'autoScalingInstanceDetails_availabilityZone' - The Availability Zone for the instance.
--
-- 'lifecycleState', 'autoScalingInstanceDetails_lifecycleState' - The lifecycle state for the instance. The @Quarantined@ state is not
-- used. For information about lifecycle states, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroupLifecycle.html Instance lifecycle>
-- in the /Amazon EC2 Auto Scaling User Guide/.
--
-- Valid Values: @Pending@ | @Pending:Wait@ | @Pending:Proceed@ |
-- @Quarantined@ | @InService@ | @Terminating@ | @Terminating:Wait@ |
-- @Terminating:Proceed@ | @Terminated@ | @Detaching@ | @Detached@ |
-- @EnteringStandby@ | @Standby@ | @Warmed:Pending@ | @Warmed:Pending:Wait@
-- | @Warmed:Pending:Proceed@ | @Warmed:Terminating@ |
-- @Warmed:Terminating:Wait@ | @Warmed:Terminating:Proceed@ |
-- @Warmed:Terminated@ | @Warmed:Stopped@ | @Warmed:Running@
--
-- 'healthStatus', 'autoScalingInstanceDetails_healthStatus' - The last reported health status of this instance. \"Healthy\" means that
-- the instance is healthy and should remain in service. \"Unhealthy\"
-- means that the instance is unhealthy and Amazon EC2 Auto Scaling should
-- terminate and replace it.
--
-- 'protectedFromScaleIn', 'autoScalingInstanceDetails_protectedFromScaleIn' - Indicates whether the instance is protected from termination by Amazon
-- EC2 Auto Scaling when scaling in.
newAutoScalingInstanceDetails ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'autoScalingGroupName'
  Prelude.Text ->
  -- | 'availabilityZone'
  Prelude.Text ->
  -- | 'lifecycleState'
  Prelude.Text ->
  -- | 'healthStatus'
  Prelude.Text ->
  -- | 'protectedFromScaleIn'
  Prelude.Bool ->
  AutoScalingInstanceDetails
newAutoScalingInstanceDetails :: Text
-> Text
-> Text
-> Text
-> Text
-> Bool
-> AutoScalingInstanceDetails
newAutoScalingInstanceDetails
  Text
pInstanceId_
  Text
pAutoScalingGroupName_
  Text
pAvailabilityZone_
  Text
pLifecycleState_
  Text
pHealthStatus_
  Bool
pProtectedFromScaleIn_ =
    AutoScalingInstanceDetails' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe LaunchTemplateSpecification
-> Text
-> Text
-> Text
-> Text
-> Text
-> Bool
-> AutoScalingInstanceDetails
AutoScalingInstanceDetails'
      { $sel:weightedCapacity:AutoScalingInstanceDetails' :: Maybe Text
weightedCapacity =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceType:AutoScalingInstanceDetails' :: Maybe Text
instanceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:launchConfigurationName:AutoScalingInstanceDetails' :: Maybe Text
launchConfigurationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:launchTemplate:AutoScalingInstanceDetails' :: Maybe LaunchTemplateSpecification
launchTemplate = Maybe LaunchTemplateSpecification
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceId:AutoScalingInstanceDetails' :: Text
instanceId = Text
pInstanceId_,
        $sel:autoScalingGroupName:AutoScalingInstanceDetails' :: Text
autoScalingGroupName = Text
pAutoScalingGroupName_,
        $sel:availabilityZone:AutoScalingInstanceDetails' :: Text
availabilityZone = Text
pAvailabilityZone_,
        $sel:lifecycleState:AutoScalingInstanceDetails' :: Text
lifecycleState = Text
pLifecycleState_,
        $sel:healthStatus:AutoScalingInstanceDetails' :: Text
healthStatus = Text
pHealthStatus_,
        $sel:protectedFromScaleIn:AutoScalingInstanceDetails' :: Bool
protectedFromScaleIn = Bool
pProtectedFromScaleIn_
      }

-- | The number of capacity units contributed by the instance based on its
-- instance type.
--
-- Valid Range: Minimum value of 1. Maximum value of 999.
autoScalingInstanceDetails_weightedCapacity :: Lens.Lens' AutoScalingInstanceDetails (Prelude.Maybe Prelude.Text)
autoScalingInstanceDetails_weightedCapacity :: (Maybe Text -> f (Maybe Text))
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_weightedCapacity = (AutoScalingInstanceDetails -> Maybe Text)
-> (AutoScalingInstanceDetails
    -> Maybe Text -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails
     AutoScalingInstanceDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Maybe Text
weightedCapacity :: Maybe Text
$sel:weightedCapacity:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Maybe Text
weightedCapacity} -> Maybe Text
weightedCapacity) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Maybe Text
a -> AutoScalingInstanceDetails
s {$sel:weightedCapacity:AutoScalingInstanceDetails' :: Maybe Text
weightedCapacity = Maybe Text
a} :: AutoScalingInstanceDetails)

-- | The instance type of the EC2 instance.
autoScalingInstanceDetails_instanceType :: Lens.Lens' AutoScalingInstanceDetails (Prelude.Maybe Prelude.Text)
autoScalingInstanceDetails_instanceType :: (Maybe Text -> f (Maybe Text))
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_instanceType = (AutoScalingInstanceDetails -> Maybe Text)
-> (AutoScalingInstanceDetails
    -> Maybe Text -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails
     AutoScalingInstanceDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Maybe Text
instanceType :: Maybe Text
$sel:instanceType:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Maybe Text
instanceType} -> Maybe Text
instanceType) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Maybe Text
a -> AutoScalingInstanceDetails
s {$sel:instanceType:AutoScalingInstanceDetails' :: Maybe Text
instanceType = Maybe Text
a} :: AutoScalingInstanceDetails)

-- | The launch configuration used to launch the instance. This value is not
-- available if you attached the instance to the Auto Scaling group.
autoScalingInstanceDetails_launchConfigurationName :: Lens.Lens' AutoScalingInstanceDetails (Prelude.Maybe Prelude.Text)
autoScalingInstanceDetails_launchConfigurationName :: (Maybe Text -> f (Maybe Text))
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_launchConfigurationName = (AutoScalingInstanceDetails -> Maybe Text)
-> (AutoScalingInstanceDetails
    -> Maybe Text -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails
     AutoScalingInstanceDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Maybe Text
launchConfigurationName :: Maybe Text
$sel:launchConfigurationName:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Maybe Text
launchConfigurationName} -> Maybe Text
launchConfigurationName) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Maybe Text
a -> AutoScalingInstanceDetails
s {$sel:launchConfigurationName:AutoScalingInstanceDetails' :: Maybe Text
launchConfigurationName = Maybe Text
a} :: AutoScalingInstanceDetails)

-- | The launch template for the instance.
autoScalingInstanceDetails_launchTemplate :: Lens.Lens' AutoScalingInstanceDetails (Prelude.Maybe LaunchTemplateSpecification)
autoScalingInstanceDetails_launchTemplate :: (Maybe LaunchTemplateSpecification
 -> f (Maybe LaunchTemplateSpecification))
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_launchTemplate = (AutoScalingInstanceDetails -> Maybe LaunchTemplateSpecification)
-> (AutoScalingInstanceDetails
    -> Maybe LaunchTemplateSpecification -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails
     AutoScalingInstanceDetails
     (Maybe LaunchTemplateSpecification)
     (Maybe LaunchTemplateSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Maybe LaunchTemplateSpecification
launchTemplate :: Maybe LaunchTemplateSpecification
$sel:launchTemplate:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Maybe LaunchTemplateSpecification
launchTemplate} -> Maybe LaunchTemplateSpecification
launchTemplate) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Maybe LaunchTemplateSpecification
a -> AutoScalingInstanceDetails
s {$sel:launchTemplate:AutoScalingInstanceDetails' :: Maybe LaunchTemplateSpecification
launchTemplate = Maybe LaunchTemplateSpecification
a} :: AutoScalingInstanceDetails)

-- | The ID of the instance.
autoScalingInstanceDetails_instanceId :: Lens.Lens' AutoScalingInstanceDetails Prelude.Text
autoScalingInstanceDetails_instanceId :: (Text -> f Text)
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_instanceId = (AutoScalingInstanceDetails -> Text)
-> (AutoScalingInstanceDetails
    -> Text -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails AutoScalingInstanceDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Text
instanceId :: Text
$sel:instanceId:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Text
instanceId} -> Text
instanceId) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Text
a -> AutoScalingInstanceDetails
s {$sel:instanceId:AutoScalingInstanceDetails' :: Text
instanceId = Text
a} :: AutoScalingInstanceDetails)

-- | The name of the Auto Scaling group for the instance.
autoScalingInstanceDetails_autoScalingGroupName :: Lens.Lens' AutoScalingInstanceDetails Prelude.Text
autoScalingInstanceDetails_autoScalingGroupName :: (Text -> f Text)
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_autoScalingGroupName = (AutoScalingInstanceDetails -> Text)
-> (AutoScalingInstanceDetails
    -> Text -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails AutoScalingInstanceDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Text
autoScalingGroupName :: Text
$sel:autoScalingGroupName:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Text
autoScalingGroupName} -> Text
autoScalingGroupName) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Text
a -> AutoScalingInstanceDetails
s {$sel:autoScalingGroupName:AutoScalingInstanceDetails' :: Text
autoScalingGroupName = Text
a} :: AutoScalingInstanceDetails)

-- | The Availability Zone for the instance.
autoScalingInstanceDetails_availabilityZone :: Lens.Lens' AutoScalingInstanceDetails Prelude.Text
autoScalingInstanceDetails_availabilityZone :: (Text -> f Text)
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_availabilityZone = (AutoScalingInstanceDetails -> Text)
-> (AutoScalingInstanceDetails
    -> Text -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails AutoScalingInstanceDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Text
availabilityZone :: Text
$sel:availabilityZone:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Text
availabilityZone} -> Text
availabilityZone) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Text
a -> AutoScalingInstanceDetails
s {$sel:availabilityZone:AutoScalingInstanceDetails' :: Text
availabilityZone = Text
a} :: AutoScalingInstanceDetails)

-- | The lifecycle state for the instance. The @Quarantined@ state is not
-- used. For information about lifecycle states, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroupLifecycle.html Instance lifecycle>
-- in the /Amazon EC2 Auto Scaling User Guide/.
--
-- Valid Values: @Pending@ | @Pending:Wait@ | @Pending:Proceed@ |
-- @Quarantined@ | @InService@ | @Terminating@ | @Terminating:Wait@ |
-- @Terminating:Proceed@ | @Terminated@ | @Detaching@ | @Detached@ |
-- @EnteringStandby@ | @Standby@ | @Warmed:Pending@ | @Warmed:Pending:Wait@
-- | @Warmed:Pending:Proceed@ | @Warmed:Terminating@ |
-- @Warmed:Terminating:Wait@ | @Warmed:Terminating:Proceed@ |
-- @Warmed:Terminated@ | @Warmed:Stopped@ | @Warmed:Running@
autoScalingInstanceDetails_lifecycleState :: Lens.Lens' AutoScalingInstanceDetails Prelude.Text
autoScalingInstanceDetails_lifecycleState :: (Text -> f Text)
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_lifecycleState = (AutoScalingInstanceDetails -> Text)
-> (AutoScalingInstanceDetails
    -> Text -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails AutoScalingInstanceDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Text
lifecycleState :: Text
$sel:lifecycleState:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Text
lifecycleState} -> Text
lifecycleState) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Text
a -> AutoScalingInstanceDetails
s {$sel:lifecycleState:AutoScalingInstanceDetails' :: Text
lifecycleState = Text
a} :: AutoScalingInstanceDetails)

-- | The last reported health status of this instance. \"Healthy\" means that
-- the instance is healthy and should remain in service. \"Unhealthy\"
-- means that the instance is unhealthy and Amazon EC2 Auto Scaling should
-- terminate and replace it.
autoScalingInstanceDetails_healthStatus :: Lens.Lens' AutoScalingInstanceDetails Prelude.Text
autoScalingInstanceDetails_healthStatus :: (Text -> f Text)
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_healthStatus = (AutoScalingInstanceDetails -> Text)
-> (AutoScalingInstanceDetails
    -> Text -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails AutoScalingInstanceDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Text
healthStatus :: Text
$sel:healthStatus:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Text
healthStatus} -> Text
healthStatus) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Text
a -> AutoScalingInstanceDetails
s {$sel:healthStatus:AutoScalingInstanceDetails' :: Text
healthStatus = Text
a} :: AutoScalingInstanceDetails)

-- | Indicates whether the instance is protected from termination by Amazon
-- EC2 Auto Scaling when scaling in.
autoScalingInstanceDetails_protectedFromScaleIn :: Lens.Lens' AutoScalingInstanceDetails Prelude.Bool
autoScalingInstanceDetails_protectedFromScaleIn :: (Bool -> f Bool)
-> AutoScalingInstanceDetails -> f AutoScalingInstanceDetails
autoScalingInstanceDetails_protectedFromScaleIn = (AutoScalingInstanceDetails -> Bool)
-> (AutoScalingInstanceDetails
    -> Bool -> AutoScalingInstanceDetails)
-> Lens
     AutoScalingInstanceDetails AutoScalingInstanceDetails Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingInstanceDetails' {Bool
protectedFromScaleIn :: Bool
$sel:protectedFromScaleIn:AutoScalingInstanceDetails' :: AutoScalingInstanceDetails -> Bool
protectedFromScaleIn} -> Bool
protectedFromScaleIn) (\s :: AutoScalingInstanceDetails
s@AutoScalingInstanceDetails' {} Bool
a -> AutoScalingInstanceDetails
s {$sel:protectedFromScaleIn:AutoScalingInstanceDetails' :: Bool
protectedFromScaleIn = Bool
a} :: AutoScalingInstanceDetails)

instance Core.FromXML AutoScalingInstanceDetails where
  parseXML :: [Node] -> Either String AutoScalingInstanceDetails
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe LaunchTemplateSpecification
-> Text
-> Text
-> Text
-> Text
-> Text
-> Bool
-> AutoScalingInstanceDetails
AutoScalingInstanceDetails'
      (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe LaunchTemplateSpecification
 -> Text
 -> Text
 -> Text
 -> Text
 -> Text
 -> Bool
 -> AutoScalingInstanceDetails)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe LaunchTemplateSpecification
      -> Text
      -> Text
      -> Text
      -> Text
      -> Text
      -> Bool
      -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"WeightedCapacity")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe LaunchTemplateSpecification
   -> Text
   -> Text
   -> Text
   -> Text
   -> Text
   -> Bool
   -> AutoScalingInstanceDetails)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe LaunchTemplateSpecification
      -> Text
      -> Text
      -> Text
      -> Text
      -> Text
      -> Bool
      -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"InstanceType")
      Either
  String
  (Maybe Text
   -> Maybe LaunchTemplateSpecification
   -> Text
   -> Text
   -> Text
   -> Text
   -> Text
   -> Bool
   -> AutoScalingInstanceDetails)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe LaunchTemplateSpecification
      -> Text
      -> Text
      -> Text
      -> Text
      -> Text
      -> Bool
      -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LaunchConfigurationName")
      Either
  String
  (Maybe LaunchTemplateSpecification
   -> Text
   -> Text
   -> Text
   -> Text
   -> Text
   -> Bool
   -> AutoScalingInstanceDetails)
-> Either String (Maybe LaunchTemplateSpecification)
-> Either
     String
     (Text
      -> Text
      -> Text
      -> Text
      -> Text
      -> Bool
      -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe LaunchTemplateSpecification)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LaunchTemplate")
      Either
  String
  (Text
   -> Text
   -> Text
   -> Text
   -> Text
   -> Bool
   -> AutoScalingInstanceDetails)
-> Either String Text
-> Either
     String
     (Text
      -> Text -> Text -> Text -> Bool -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"InstanceId")
      Either
  String
  (Text
   -> Text -> Text -> Text -> Bool -> AutoScalingInstanceDetails)
-> Either String Text
-> Either
     String (Text -> Text -> Text -> Bool -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"AutoScalingGroupName")
      Either
  String (Text -> Text -> Text -> Bool -> AutoScalingInstanceDetails)
-> Either String Text
-> Either
     String (Text -> Text -> Bool -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"AvailabilityZone")
      Either String (Text -> Text -> Bool -> AutoScalingInstanceDetails)
-> Either String Text
-> Either String (Text -> Bool -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LifecycleState")
      Either String (Text -> Bool -> AutoScalingInstanceDetails)
-> Either String Text
-> Either String (Bool -> AutoScalingInstanceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HealthStatus")
      Either String (Bool -> AutoScalingInstanceDetails)
-> Either String Bool -> Either String AutoScalingInstanceDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Bool
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ProtectedFromScaleIn")

instance Prelude.Hashable AutoScalingInstanceDetails

instance Prelude.NFData AutoScalingInstanceDetails