{-# 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 #-}
module Amazonka.AutoScaling.Types.Instance where
import Amazonka.AutoScaling.Types.LaunchTemplateSpecification
import Amazonka.AutoScaling.Types.LifecycleState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Instance = Instance'
{
Instance -> Maybe Text
weightedCapacity :: Prelude.Maybe Prelude.Text,
Instance -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
Instance -> Maybe Text
launchConfigurationName :: Prelude.Maybe Prelude.Text,
Instance -> Maybe LaunchTemplateSpecification
launchTemplate :: Prelude.Maybe LaunchTemplateSpecification,
Instance -> Text
instanceId :: Prelude.Text,
Instance -> Text
availabilityZone :: Prelude.Text,
Instance -> LifecycleState
lifecycleState :: LifecycleState,
Instance -> Text
healthStatus :: Prelude.Text,
Instance -> Bool
protectedFromScaleIn :: Prelude.Bool
}
deriving (Instance -> Instance -> Bool
(Instance -> Instance -> Bool)
-> (Instance -> Instance -> Bool) -> Eq Instance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Instance -> Instance -> Bool
$c/= :: Instance -> Instance -> Bool
== :: Instance -> Instance -> Bool
$c== :: Instance -> Instance -> Bool
Prelude.Eq, ReadPrec [Instance]
ReadPrec Instance
Int -> ReadS Instance
ReadS [Instance]
(Int -> ReadS Instance)
-> ReadS [Instance]
-> ReadPrec Instance
-> ReadPrec [Instance]
-> Read Instance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Instance]
$creadListPrec :: ReadPrec [Instance]
readPrec :: ReadPrec Instance
$creadPrec :: ReadPrec Instance
readList :: ReadS [Instance]
$creadList :: ReadS [Instance]
readsPrec :: Int -> ReadS Instance
$creadsPrec :: Int -> ReadS Instance
Prelude.Read, Int -> Instance -> ShowS
[Instance] -> ShowS
Instance -> String
(Int -> Instance -> ShowS)
-> (Instance -> String) -> ([Instance] -> ShowS) -> Show Instance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Instance] -> ShowS
$cshowList :: [Instance] -> ShowS
show :: Instance -> String
$cshow :: Instance -> String
showsPrec :: Int -> Instance -> ShowS
$cshowsPrec :: Int -> Instance -> ShowS
Prelude.Show, (forall x. Instance -> Rep Instance x)
-> (forall x. Rep Instance x -> Instance) -> Generic Instance
forall x. Rep Instance x -> Instance
forall x. Instance -> Rep Instance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Instance x -> Instance
$cfrom :: forall x. Instance -> Rep Instance x
Prelude.Generic)
newInstance ::
Prelude.Text ->
Prelude.Text ->
LifecycleState ->
Prelude.Text ->
Prelude.Bool ->
Instance
newInstance :: Text -> Text -> LifecycleState -> Text -> Bool -> Instance
newInstance
Text
pInstanceId_
Text
pAvailabilityZone_
LifecycleState
pLifecycleState_
Text
pHealthStatus_
Bool
pProtectedFromScaleIn_ =
Instance' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe LaunchTemplateSpecification
-> Text
-> Text
-> LifecycleState
-> Text
-> Bool
-> Instance
Instance'
{ $sel:weightedCapacity:Instance' :: Maybe Text
weightedCapacity = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:instanceType:Instance' :: Maybe Text
instanceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:launchConfigurationName:Instance' :: Maybe Text
launchConfigurationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:launchTemplate:Instance' :: Maybe LaunchTemplateSpecification
launchTemplate = Maybe LaunchTemplateSpecification
forall a. Maybe a
Prelude.Nothing,
$sel:instanceId:Instance' :: Text
instanceId = Text
pInstanceId_,
$sel:availabilityZone:Instance' :: Text
availabilityZone = Text
pAvailabilityZone_,
$sel:lifecycleState:Instance' :: LifecycleState
lifecycleState = LifecycleState
pLifecycleState_,
$sel:healthStatus:Instance' :: Text
healthStatus = Text
pHealthStatus_,
$sel:protectedFromScaleIn:Instance' :: Bool
protectedFromScaleIn = Bool
pProtectedFromScaleIn_
}
instance_weightedCapacity :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_weightedCapacity :: (Maybe Text -> f (Maybe Text)) -> Instance -> f Instance
instance_weightedCapacity = (Instance -> Maybe Text)
-> (Instance -> Maybe Text -> Instance)
-> Lens Instance Instance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
weightedCapacity :: Maybe Text
$sel:weightedCapacity:Instance' :: Instance -> Maybe Text
weightedCapacity} -> Maybe Text
weightedCapacity) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:weightedCapacity:Instance' :: Maybe Text
weightedCapacity = Maybe Text
a} :: Instance)
instance_instanceType :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_instanceType :: (Maybe Text -> f (Maybe Text)) -> Instance -> f Instance
instance_instanceType = (Instance -> Maybe Text)
-> (Instance -> Maybe Text -> Instance)
-> Lens Instance Instance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
instanceType :: Maybe Text
$sel:instanceType:Instance' :: Instance -> Maybe Text
instanceType} -> Maybe Text
instanceType) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:instanceType:Instance' :: Maybe Text
instanceType = Maybe Text
a} :: Instance)
instance_launchConfigurationName :: Lens.Lens' Instance (Prelude.Maybe Prelude.Text)
instance_launchConfigurationName :: (Maybe Text -> f (Maybe Text)) -> Instance -> f Instance
instance_launchConfigurationName = (Instance -> Maybe Text)
-> (Instance -> Maybe Text -> Instance)
-> Lens Instance Instance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe Text
launchConfigurationName :: Maybe Text
$sel:launchConfigurationName:Instance' :: Instance -> Maybe Text
launchConfigurationName} -> Maybe Text
launchConfigurationName) (\s :: Instance
s@Instance' {} Maybe Text
a -> Instance
s {$sel:launchConfigurationName:Instance' :: Maybe Text
launchConfigurationName = Maybe Text
a} :: Instance)
instance_launchTemplate :: Lens.Lens' Instance (Prelude.Maybe LaunchTemplateSpecification)
instance_launchTemplate :: (Maybe LaunchTemplateSpecification
-> f (Maybe LaunchTemplateSpecification))
-> Instance -> f Instance
instance_launchTemplate = (Instance -> Maybe LaunchTemplateSpecification)
-> (Instance -> Maybe LaunchTemplateSpecification -> Instance)
-> Lens
Instance
Instance
(Maybe LaunchTemplateSpecification)
(Maybe LaunchTemplateSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Maybe LaunchTemplateSpecification
launchTemplate :: Maybe LaunchTemplateSpecification
$sel:launchTemplate:Instance' :: Instance -> Maybe LaunchTemplateSpecification
launchTemplate} -> Maybe LaunchTemplateSpecification
launchTemplate) (\s :: Instance
s@Instance' {} Maybe LaunchTemplateSpecification
a -> Instance
s {$sel:launchTemplate:Instance' :: Maybe LaunchTemplateSpecification
launchTemplate = Maybe LaunchTemplateSpecification
a} :: Instance)
instance_instanceId :: Lens.Lens' Instance Prelude.Text
instance_instanceId :: (Text -> f Text) -> Instance -> f Instance
instance_instanceId = (Instance -> Text)
-> (Instance -> Text -> Instance)
-> Lens Instance Instance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Text
instanceId :: Text
$sel:instanceId:Instance' :: Instance -> Text
instanceId} -> Text
instanceId) (\s :: Instance
s@Instance' {} Text
a -> Instance
s {$sel:instanceId:Instance' :: Text
instanceId = Text
a} :: Instance)
instance_availabilityZone :: Lens.Lens' Instance Prelude.Text
instance_availabilityZone :: (Text -> f Text) -> Instance -> f Instance
instance_availabilityZone = (Instance -> Text)
-> (Instance -> Text -> Instance)
-> Lens Instance Instance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Text
availabilityZone :: Text
$sel:availabilityZone:Instance' :: Instance -> Text
availabilityZone} -> Text
availabilityZone) (\s :: Instance
s@Instance' {} Text
a -> Instance
s {$sel:availabilityZone:Instance' :: Text
availabilityZone = Text
a} :: Instance)
instance_lifecycleState :: Lens.Lens' Instance LifecycleState
instance_lifecycleState :: (LifecycleState -> f LifecycleState) -> Instance -> f Instance
instance_lifecycleState = (Instance -> LifecycleState)
-> (Instance -> LifecycleState -> Instance)
-> Lens Instance Instance LifecycleState LifecycleState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {LifecycleState
lifecycleState :: LifecycleState
$sel:lifecycleState:Instance' :: Instance -> LifecycleState
lifecycleState} -> LifecycleState
lifecycleState) (\s :: Instance
s@Instance' {} LifecycleState
a -> Instance
s {$sel:lifecycleState:Instance' :: LifecycleState
lifecycleState = LifecycleState
a} :: Instance)
instance_healthStatus :: Lens.Lens' Instance Prelude.Text
instance_healthStatus :: (Text -> f Text) -> Instance -> f Instance
instance_healthStatus = (Instance -> Text)
-> (Instance -> Text -> Instance)
-> Lens Instance Instance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Text
healthStatus :: Text
$sel:healthStatus:Instance' :: Instance -> Text
healthStatus} -> Text
healthStatus) (\s :: Instance
s@Instance' {} Text
a -> Instance
s {$sel:healthStatus:Instance' :: Text
healthStatus = Text
a} :: Instance)
instance_protectedFromScaleIn :: Lens.Lens' Instance Prelude.Bool
instance_protectedFromScaleIn :: (Bool -> f Bool) -> Instance -> f Instance
instance_protectedFromScaleIn = (Instance -> Bool)
-> (Instance -> Bool -> Instance)
-> Lens Instance Instance Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Instance' {Bool
protectedFromScaleIn :: Bool
$sel:protectedFromScaleIn:Instance' :: Instance -> Bool
protectedFromScaleIn} -> Bool
protectedFromScaleIn) (\s :: Instance
s@Instance' {} Bool
a -> Instance
s {$sel:protectedFromScaleIn:Instance' :: Bool
protectedFromScaleIn = Bool
a} :: Instance)
instance Core.FromXML Instance where
parseXML :: [Node] -> Either String Instance
parseXML [Node]
x =
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe LaunchTemplateSpecification
-> Text
-> Text
-> LifecycleState
-> Text
-> Bool
-> Instance
Instance'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe LaunchTemplateSpecification
-> Text
-> Text
-> LifecycleState
-> Text
-> Bool
-> Instance)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe Text
-> Maybe LaunchTemplateSpecification
-> Text
-> Text
-> LifecycleState
-> Text
-> Bool
-> Instance)
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
-> LifecycleState
-> Text
-> Bool
-> Instance)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe LaunchTemplateSpecification
-> Text
-> Text
-> LifecycleState
-> Text
-> Bool
-> Instance)
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
-> LifecycleState
-> Text
-> Bool
-> Instance)
-> Either String (Maybe Text)
-> Either
String
(Maybe LaunchTemplateSpecification
-> Text -> Text -> LifecycleState -> Text -> Bool -> Instance)
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 -> LifecycleState -> Text -> Bool -> Instance)
-> Either String (Maybe LaunchTemplateSpecification)
-> Either
String (Text -> Text -> LifecycleState -> Text -> Bool -> Instance)
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 -> LifecycleState -> Text -> Bool -> Instance)
-> Either String Text
-> Either
String (Text -> LifecycleState -> Text -> Bool -> Instance)
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 -> LifecycleState -> Text -> Bool -> Instance)
-> Either String Text
-> Either String (LifecycleState -> Text -> Bool -> Instance)
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 (LifecycleState -> Text -> Bool -> Instance)
-> Either String LifecycleState
-> Either String (Text -> Bool -> Instance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String LifecycleState
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LifecycleState")
Either String (Text -> Bool -> Instance)
-> Either String Text -> Either String (Bool -> Instance)
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 -> Instance)
-> Either String Bool -> Either String Instance
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 Instance
instance Prelude.NFData Instance