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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ELBInfo -> ELBInfo -> Bool)
-> (ELBInfo -> ELBInfo -> Bool) -> Eq ELBInfo
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]
(Int -> ReadS ELBInfo)
-> ReadS [ELBInfo]
-> ReadPrec ELBInfo
-> ReadPrec [ELBInfo]
-> Read 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
(Int -> ELBInfo -> ShowS)
-> (ELBInfo -> String) -> ([ELBInfo] -> ShowS) -> Show ELBInfo
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. ELBInfo -> Rep ELBInfo x)
-> (forall x. Rep ELBInfo x -> ELBInfo) -> Generic ELBInfo
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' :: Maybe Text -> ELBInfo
ELBInfo' {$sel:name:ELBInfo' :: Maybe Text
name = Maybe Text
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 :: (Maybe Text -> f (Maybe Text)) -> ELBInfo -> f ELBInfo
eLBInfo_name = (ELBInfo -> Maybe Text)
-> (ELBInfo -> Maybe Text -> ELBInfo)
-> Lens ELBInfo ELBInfo (Maybe Text) (Maybe Text)
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 Core.FromJSON ELBInfo where
  parseJSON :: Value -> Parser ELBInfo
parseJSON =
    String -> (Object -> Parser ELBInfo) -> Value -> Parser ELBInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ELBInfo"
      (\Object
x -> Maybe Text -> ELBInfo
ELBInfo' (Maybe Text -> ELBInfo) -> Parser (Maybe Text) -> Parser ELBInfo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name"))

instance Prelude.Hashable ELBInfo

instance Prelude.NFData ELBInfo

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