{-# 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.CodeDeploy.Types.ELBInfo
-- 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.CodeDeploy.Types.ELBInfo 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

-- | Information about a load balancer in Elastic Load Balancing to use in a
-- deployment. Instances are registered directly with a load balancer, and
-- traffic is routed to the load balancer.
--
-- /See:/ 'newELBInfo' smart constructor.
data ELBInfo = ELBInfo'
  { -- | For blue\/green deployments, the name of the load balancer that is used
    -- to route traffic from original instances to replacement instances in a
    -- blue\/green deployment. For in-place deployments, the name of the load
    -- balancer that instances are deregistered from so they are not serving
    -- traffic during a deployment, and then re-registered with after the
    -- deployment is complete.
    ELBInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (ELBInfo -> ELBInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ELBInfo -> ELBInfo -> Bool
$c/= :: ELBInfo -> ELBInfo -> Bool
== :: ELBInfo -> ELBInfo -> Bool
$c== :: ELBInfo -> ELBInfo -> Bool
Prelude.Eq, ReadPrec [ELBInfo]
ReadPrec ELBInfo
Int -> ReadS ELBInfo
ReadS [ELBInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ELBInfo]
$creadListPrec :: ReadPrec [ELBInfo]
readPrec :: ReadPrec ELBInfo
$creadPrec :: ReadPrec ELBInfo
readList :: ReadS [ELBInfo]
$creadList :: ReadS [ELBInfo]
readsPrec :: Int -> ReadS ELBInfo
$creadsPrec :: Int -> ReadS ELBInfo
Prelude.Read, Int -> ELBInfo -> ShowS
[ELBInfo] -> ShowS
ELBInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ELBInfo] -> ShowS
$cshowList :: [ELBInfo] -> ShowS
show :: ELBInfo -> String
$cshow :: ELBInfo -> String
showsPrec :: Int -> ELBInfo -> ShowS
$cshowsPrec :: Int -> ELBInfo -> ShowS
Prelude.Show, forall x. Rep ELBInfo x -> ELBInfo
forall x. ELBInfo -> Rep ELBInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ELBInfo x -> ELBInfo
$cfrom :: forall x. ELBInfo -> Rep ELBInfo x
Prelude.Generic)

-- |
-- Create a value of 'ELBInfo' 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:
--
-- 'name', 'eLBInfo_name' - For blue\/green deployments, the name of the load balancer that is used
-- to route traffic from original instances to replacement instances in a
-- blue\/green deployment. For in-place deployments, the name of the load
-- balancer that instances are deregistered from so they are not serving
-- traffic during a deployment, and then re-registered with after the
-- deployment is complete.
newELBInfo ::
  ELBInfo
newELBInfo :: ELBInfo
newELBInfo = ELBInfo' {$sel:name:ELBInfo' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing}

-- | For blue\/green deployments, the name of the load balancer that is used
-- to route traffic from original instances to replacement instances in a
-- blue\/green deployment. For in-place deployments, the name of the load
-- balancer that instances are deregistered from so they are not serving
-- traffic during a deployment, and then re-registered with after the
-- deployment is complete.
eLBInfo_name :: Lens.Lens' ELBInfo (Prelude.Maybe Prelude.Text)
eLBInfo_name :: Lens' ELBInfo (Maybe Text)
eLBInfo_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ELBInfo' {Maybe Text
name :: Maybe Text
$sel:name:ELBInfo' :: ELBInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: ELBInfo
s@ELBInfo' {} Maybe Text
a -> ELBInfo
s {$sel:name:ELBInfo' :: Maybe Text
name = Maybe Text
a} :: ELBInfo)

instance Data.FromJSON ELBInfo where
  parseJSON :: Value -> Parser ELBInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ELBInfo"
      (\Object
x -> Maybe Text -> ELBInfo
ELBInfo' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name"))

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

instance Prelude.NFData ELBInfo where
  rnf :: ELBInfo -> ()
rnf ELBInfo' {Maybe Text
name :: Maybe Text
$sel:name:ELBInfo' :: ELBInfo -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name

instance Data.ToJSON ELBInfo where
  toJSON :: ELBInfo -> Value
toJSON ELBInfo' {Maybe Text
name :: Maybe Text
$sel:name:ELBInfo' :: ELBInfo -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name]
      )