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

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

-- | Describes the state of a target group.
--
-- /See:/ 'newLoadBalancerTargetGroupState' smart constructor.
data LoadBalancerTargetGroupState = LoadBalancerTargetGroupState'
  { -- | The state of the target group.
    --
    -- -   @Adding@ - The Auto Scaling instances are being registered with the
    --     target group.
    --
    -- -   @Added@ - All Auto Scaling instances are registered with the target
    --     group.
    --
    -- -   @InService@ - At least one Auto Scaling instance passed an @ELB@
    --     health check.
    --
    -- -   @Removing@ - The Auto Scaling instances are being deregistered from
    --     the target group. If connection draining is enabled, Elastic Load
    --     Balancing waits for in-flight requests to complete before
    --     deregistering the instances.
    --
    -- -   @Removed@ - All Auto Scaling instances are deregistered from the
    --     target group.
    LoadBalancerTargetGroupState -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the target group.
    LoadBalancerTargetGroupState -> Maybe Text
loadBalancerTargetGroupARN :: Prelude.Maybe Prelude.Text
  }
  deriving (LoadBalancerTargetGroupState
-> LoadBalancerTargetGroupState -> Bool
(LoadBalancerTargetGroupState
 -> LoadBalancerTargetGroupState -> Bool)
-> (LoadBalancerTargetGroupState
    -> LoadBalancerTargetGroupState -> Bool)
-> Eq LoadBalancerTargetGroupState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoadBalancerTargetGroupState
-> LoadBalancerTargetGroupState -> Bool
$c/= :: LoadBalancerTargetGroupState
-> LoadBalancerTargetGroupState -> Bool
== :: LoadBalancerTargetGroupState
-> LoadBalancerTargetGroupState -> Bool
$c== :: LoadBalancerTargetGroupState
-> LoadBalancerTargetGroupState -> Bool
Prelude.Eq, ReadPrec [LoadBalancerTargetGroupState]
ReadPrec LoadBalancerTargetGroupState
Int -> ReadS LoadBalancerTargetGroupState
ReadS [LoadBalancerTargetGroupState]
(Int -> ReadS LoadBalancerTargetGroupState)
-> ReadS [LoadBalancerTargetGroupState]
-> ReadPrec LoadBalancerTargetGroupState
-> ReadPrec [LoadBalancerTargetGroupState]
-> Read LoadBalancerTargetGroupState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoadBalancerTargetGroupState]
$creadListPrec :: ReadPrec [LoadBalancerTargetGroupState]
readPrec :: ReadPrec LoadBalancerTargetGroupState
$creadPrec :: ReadPrec LoadBalancerTargetGroupState
readList :: ReadS [LoadBalancerTargetGroupState]
$creadList :: ReadS [LoadBalancerTargetGroupState]
readsPrec :: Int -> ReadS LoadBalancerTargetGroupState
$creadsPrec :: Int -> ReadS LoadBalancerTargetGroupState
Prelude.Read, Int -> LoadBalancerTargetGroupState -> ShowS
[LoadBalancerTargetGroupState] -> ShowS
LoadBalancerTargetGroupState -> String
(Int -> LoadBalancerTargetGroupState -> ShowS)
-> (LoadBalancerTargetGroupState -> String)
-> ([LoadBalancerTargetGroupState] -> ShowS)
-> Show LoadBalancerTargetGroupState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoadBalancerTargetGroupState] -> ShowS
$cshowList :: [LoadBalancerTargetGroupState] -> ShowS
show :: LoadBalancerTargetGroupState -> String
$cshow :: LoadBalancerTargetGroupState -> String
showsPrec :: Int -> LoadBalancerTargetGroupState -> ShowS
$cshowsPrec :: Int -> LoadBalancerTargetGroupState -> ShowS
Prelude.Show, (forall x.
 LoadBalancerTargetGroupState -> Rep LoadBalancerTargetGroupState x)
-> (forall x.
    Rep LoadBalancerTargetGroupState x -> LoadBalancerTargetGroupState)
-> Generic LoadBalancerTargetGroupState
forall x.
Rep LoadBalancerTargetGroupState x -> LoadBalancerTargetGroupState
forall x.
LoadBalancerTargetGroupState -> Rep LoadBalancerTargetGroupState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LoadBalancerTargetGroupState x -> LoadBalancerTargetGroupState
$cfrom :: forall x.
LoadBalancerTargetGroupState -> Rep LoadBalancerTargetGroupState x
Prelude.Generic)

-- |
-- Create a value of 'LoadBalancerTargetGroupState' 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:
--
-- 'state', 'loadBalancerTargetGroupState_state' - The state of the target group.
--
-- -   @Adding@ - The Auto Scaling instances are being registered with the
--     target group.
--
-- -   @Added@ - All Auto Scaling instances are registered with the target
--     group.
--
-- -   @InService@ - At least one Auto Scaling instance passed an @ELB@
--     health check.
--
-- -   @Removing@ - The Auto Scaling instances are being deregistered from
--     the target group. If connection draining is enabled, Elastic Load
--     Balancing waits for in-flight requests to complete before
--     deregistering the instances.
--
-- -   @Removed@ - All Auto Scaling instances are deregistered from the
--     target group.
--
-- 'loadBalancerTargetGroupARN', 'loadBalancerTargetGroupState_loadBalancerTargetGroupARN' - The Amazon Resource Name (ARN) of the target group.
newLoadBalancerTargetGroupState ::
  LoadBalancerTargetGroupState
newLoadBalancerTargetGroupState :: LoadBalancerTargetGroupState
newLoadBalancerTargetGroupState =
  LoadBalancerTargetGroupState' :: Maybe Text -> Maybe Text -> LoadBalancerTargetGroupState
LoadBalancerTargetGroupState'
    { $sel:state:LoadBalancerTargetGroupState' :: Maybe Text
state =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:loadBalancerTargetGroupARN:LoadBalancerTargetGroupState' :: Maybe Text
loadBalancerTargetGroupARN = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the target group.
--
-- -   @Adding@ - The Auto Scaling instances are being registered with the
--     target group.
--
-- -   @Added@ - All Auto Scaling instances are registered with the target
--     group.
--
-- -   @InService@ - At least one Auto Scaling instance passed an @ELB@
--     health check.
--
-- -   @Removing@ - The Auto Scaling instances are being deregistered from
--     the target group. If connection draining is enabled, Elastic Load
--     Balancing waits for in-flight requests to complete before
--     deregistering the instances.
--
-- -   @Removed@ - All Auto Scaling instances are deregistered from the
--     target group.
loadBalancerTargetGroupState_state :: Lens.Lens' LoadBalancerTargetGroupState (Prelude.Maybe Prelude.Text)
loadBalancerTargetGroupState_state :: (Maybe Text -> f (Maybe Text))
-> LoadBalancerTargetGroupState -> f LoadBalancerTargetGroupState
loadBalancerTargetGroupState_state = (LoadBalancerTargetGroupState -> Maybe Text)
-> (LoadBalancerTargetGroupState
    -> Maybe Text -> LoadBalancerTargetGroupState)
-> Lens
     LoadBalancerTargetGroupState
     LoadBalancerTargetGroupState
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancerTargetGroupState' {Maybe Text
state :: Maybe Text
$sel:state:LoadBalancerTargetGroupState' :: LoadBalancerTargetGroupState -> Maybe Text
state} -> Maybe Text
state) (\s :: LoadBalancerTargetGroupState
s@LoadBalancerTargetGroupState' {} Maybe Text
a -> LoadBalancerTargetGroupState
s {$sel:state:LoadBalancerTargetGroupState' :: Maybe Text
state = Maybe Text
a} :: LoadBalancerTargetGroupState)

-- | The Amazon Resource Name (ARN) of the target group.
loadBalancerTargetGroupState_loadBalancerTargetGroupARN :: Lens.Lens' LoadBalancerTargetGroupState (Prelude.Maybe Prelude.Text)
loadBalancerTargetGroupState_loadBalancerTargetGroupARN :: (Maybe Text -> f (Maybe Text))
-> LoadBalancerTargetGroupState -> f LoadBalancerTargetGroupState
loadBalancerTargetGroupState_loadBalancerTargetGroupARN = (LoadBalancerTargetGroupState -> Maybe Text)
-> (LoadBalancerTargetGroupState
    -> Maybe Text -> LoadBalancerTargetGroupState)
-> Lens
     LoadBalancerTargetGroupState
     LoadBalancerTargetGroupState
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancerTargetGroupState' {Maybe Text
loadBalancerTargetGroupARN :: Maybe Text
$sel:loadBalancerTargetGroupARN:LoadBalancerTargetGroupState' :: LoadBalancerTargetGroupState -> Maybe Text
loadBalancerTargetGroupARN} -> Maybe Text
loadBalancerTargetGroupARN) (\s :: LoadBalancerTargetGroupState
s@LoadBalancerTargetGroupState' {} Maybe Text
a -> LoadBalancerTargetGroupState
s {$sel:loadBalancerTargetGroupARN:LoadBalancerTargetGroupState' :: Maybe Text
loadBalancerTargetGroupARN = Maybe Text
a} :: LoadBalancerTargetGroupState)

instance Core.FromXML LoadBalancerTargetGroupState where
  parseXML :: [Node] -> Either String LoadBalancerTargetGroupState
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> LoadBalancerTargetGroupState
LoadBalancerTargetGroupState'
      (Maybe Text -> Maybe Text -> LoadBalancerTargetGroupState)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> LoadBalancerTargetGroupState)
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
"State")
      Either String (Maybe Text -> LoadBalancerTargetGroupState)
-> Either String (Maybe Text)
-> Either String LoadBalancerTargetGroupState
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
"LoadBalancerTargetGroupARN")

instance
  Prelude.Hashable
    LoadBalancerTargetGroupState

instance Prelude.NFData LoadBalancerTargetGroupState