{-# 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.TrafficSourceState
-- 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.TrafficSourceState 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

-- | Describes the state of a traffic source.
--
-- /See:/ 'newTrafficSourceState' smart constructor.
data TrafficSourceState = TrafficSourceState'
  { -- | The following are the possible states for a VPC Lattice 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 the
    --     @VPC_LATTICE@ health check.
    --
    -- -   @Removing@ - The Auto Scaling instances are being deregistered from
    --     the target group. If connection draining is enabled, VPC Lattice
    --     waits for in-flight requests to complete before deregistering the
    --     instances.
    --
    -- -   @Removed@ - All Auto Scaling instances are deregistered from the
    --     target group.
    TrafficSourceState -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the traffic source. Currently, this is the
    -- Amazon Resource Name (ARN) for a VPC Lattice target group.
    TrafficSourceState -> Maybe Text
trafficSource :: Prelude.Maybe Prelude.Text
  }
  deriving (TrafficSourceState -> TrafficSourceState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrafficSourceState -> TrafficSourceState -> Bool
$c/= :: TrafficSourceState -> TrafficSourceState -> Bool
== :: TrafficSourceState -> TrafficSourceState -> Bool
$c== :: TrafficSourceState -> TrafficSourceState -> Bool
Prelude.Eq, ReadPrec [TrafficSourceState]
ReadPrec TrafficSourceState
Int -> ReadS TrafficSourceState
ReadS [TrafficSourceState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrafficSourceState]
$creadListPrec :: ReadPrec [TrafficSourceState]
readPrec :: ReadPrec TrafficSourceState
$creadPrec :: ReadPrec TrafficSourceState
readList :: ReadS [TrafficSourceState]
$creadList :: ReadS [TrafficSourceState]
readsPrec :: Int -> ReadS TrafficSourceState
$creadsPrec :: Int -> ReadS TrafficSourceState
Prelude.Read, Int -> TrafficSourceState -> ShowS
[TrafficSourceState] -> ShowS
TrafficSourceState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrafficSourceState] -> ShowS
$cshowList :: [TrafficSourceState] -> ShowS
show :: TrafficSourceState -> String
$cshow :: TrafficSourceState -> String
showsPrec :: Int -> TrafficSourceState -> ShowS
$cshowsPrec :: Int -> TrafficSourceState -> ShowS
Prelude.Show, forall x. Rep TrafficSourceState x -> TrafficSourceState
forall x. TrafficSourceState -> Rep TrafficSourceState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrafficSourceState x -> TrafficSourceState
$cfrom :: forall x. TrafficSourceState -> Rep TrafficSourceState x
Prelude.Generic)

-- |
-- Create a value of 'TrafficSourceState' 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', 'trafficSourceState_state' - The following are the possible states for a VPC Lattice 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 the
--     @VPC_LATTICE@ health check.
--
-- -   @Removing@ - The Auto Scaling instances are being deregistered from
--     the target group. If connection draining is enabled, VPC Lattice
--     waits for in-flight requests to complete before deregistering the
--     instances.
--
-- -   @Removed@ - All Auto Scaling instances are deregistered from the
--     target group.
--
-- 'trafficSource', 'trafficSourceState_trafficSource' - The unique identifier of the traffic source. Currently, this is the
-- Amazon Resource Name (ARN) for a VPC Lattice target group.
newTrafficSourceState ::
  TrafficSourceState
newTrafficSourceState :: TrafficSourceState
newTrafficSourceState =
  TrafficSourceState'
    { $sel:state:TrafficSourceState' :: Maybe Text
state = forall a. Maybe a
Prelude.Nothing,
      $sel:trafficSource:TrafficSourceState' :: Maybe Text
trafficSource = forall a. Maybe a
Prelude.Nothing
    }

-- | The following are the possible states for a VPC Lattice 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 the
--     @VPC_LATTICE@ health check.
--
-- -   @Removing@ - The Auto Scaling instances are being deregistered from
--     the target group. If connection draining is enabled, VPC Lattice
--     waits for in-flight requests to complete before deregistering the
--     instances.
--
-- -   @Removed@ - All Auto Scaling instances are deregistered from the
--     target group.
trafficSourceState_state :: Lens.Lens' TrafficSourceState (Prelude.Maybe Prelude.Text)
trafficSourceState_state :: Lens' TrafficSourceState (Maybe Text)
trafficSourceState_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrafficSourceState' {Maybe Text
state :: Maybe Text
$sel:state:TrafficSourceState' :: TrafficSourceState -> Maybe Text
state} -> Maybe Text
state) (\s :: TrafficSourceState
s@TrafficSourceState' {} Maybe Text
a -> TrafficSourceState
s {$sel:state:TrafficSourceState' :: Maybe Text
state = Maybe Text
a} :: TrafficSourceState)

-- | The unique identifier of the traffic source. Currently, this is the
-- Amazon Resource Name (ARN) for a VPC Lattice target group.
trafficSourceState_trafficSource :: Lens.Lens' TrafficSourceState (Prelude.Maybe Prelude.Text)
trafficSourceState_trafficSource :: Lens' TrafficSourceState (Maybe Text)
trafficSourceState_trafficSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrafficSourceState' {Maybe Text
trafficSource :: Maybe Text
$sel:trafficSource:TrafficSourceState' :: TrafficSourceState -> Maybe Text
trafficSource} -> Maybe Text
trafficSource) (\s :: TrafficSourceState
s@TrafficSourceState' {} Maybe Text
a -> TrafficSourceState
s {$sel:trafficSource:TrafficSourceState' :: Maybe Text
trafficSource = Maybe Text
a} :: TrafficSourceState)

instance Data.FromXML TrafficSourceState where
  parseXML :: [Node] -> Either String TrafficSourceState
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> TrafficSourceState
TrafficSourceState'
      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
"State")
      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
"TrafficSource")

instance Prelude.Hashable TrafficSourceState where
  hashWithSalt :: Int -> TrafficSourceState -> Int
hashWithSalt Int
_salt TrafficSourceState' {Maybe Text
trafficSource :: Maybe Text
state :: Maybe Text
$sel:trafficSource:TrafficSourceState' :: TrafficSourceState -> Maybe Text
$sel:state:TrafficSourceState' :: TrafficSourceState -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trafficSource

instance Prelude.NFData TrafficSourceState where
  rnf :: TrafficSourceState -> ()
rnf TrafficSourceState' {Maybe Text
trafficSource :: Maybe Text
state :: Maybe Text
$sel:trafficSource:TrafficSourceState' :: TrafficSourceState -> Maybe Text
$sel:state:TrafficSourceState' :: TrafficSourceState -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
trafficSource