{-# 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.ELB.Types.CrossZoneLoadBalancing
-- 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.ELB.Types.CrossZoneLoadBalancing where

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

-- | Information about the @CrossZoneLoadBalancing@ attribute.
--
-- /See:/ 'newCrossZoneLoadBalancing' smart constructor.
data CrossZoneLoadBalancing = CrossZoneLoadBalancing'
  { -- | Specifies whether cross-zone load balancing is enabled for the load
    -- balancer.
    CrossZoneLoadBalancing -> Bool
enabled :: Prelude.Bool
  }
  deriving (CrossZoneLoadBalancing -> CrossZoneLoadBalancing -> Bool
(CrossZoneLoadBalancing -> CrossZoneLoadBalancing -> Bool)
-> (CrossZoneLoadBalancing -> CrossZoneLoadBalancing -> Bool)
-> Eq CrossZoneLoadBalancing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CrossZoneLoadBalancing -> CrossZoneLoadBalancing -> Bool
$c/= :: CrossZoneLoadBalancing -> CrossZoneLoadBalancing -> Bool
== :: CrossZoneLoadBalancing -> CrossZoneLoadBalancing -> Bool
$c== :: CrossZoneLoadBalancing -> CrossZoneLoadBalancing -> Bool
Prelude.Eq, ReadPrec [CrossZoneLoadBalancing]
ReadPrec CrossZoneLoadBalancing
Int -> ReadS CrossZoneLoadBalancing
ReadS [CrossZoneLoadBalancing]
(Int -> ReadS CrossZoneLoadBalancing)
-> ReadS [CrossZoneLoadBalancing]
-> ReadPrec CrossZoneLoadBalancing
-> ReadPrec [CrossZoneLoadBalancing]
-> Read CrossZoneLoadBalancing
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CrossZoneLoadBalancing]
$creadListPrec :: ReadPrec [CrossZoneLoadBalancing]
readPrec :: ReadPrec CrossZoneLoadBalancing
$creadPrec :: ReadPrec CrossZoneLoadBalancing
readList :: ReadS [CrossZoneLoadBalancing]
$creadList :: ReadS [CrossZoneLoadBalancing]
readsPrec :: Int -> ReadS CrossZoneLoadBalancing
$creadsPrec :: Int -> ReadS CrossZoneLoadBalancing
Prelude.Read, Int -> CrossZoneLoadBalancing -> ShowS
[CrossZoneLoadBalancing] -> ShowS
CrossZoneLoadBalancing -> String
(Int -> CrossZoneLoadBalancing -> ShowS)
-> (CrossZoneLoadBalancing -> String)
-> ([CrossZoneLoadBalancing] -> ShowS)
-> Show CrossZoneLoadBalancing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CrossZoneLoadBalancing] -> ShowS
$cshowList :: [CrossZoneLoadBalancing] -> ShowS
show :: CrossZoneLoadBalancing -> String
$cshow :: CrossZoneLoadBalancing -> String
showsPrec :: Int -> CrossZoneLoadBalancing -> ShowS
$cshowsPrec :: Int -> CrossZoneLoadBalancing -> ShowS
Prelude.Show, (forall x. CrossZoneLoadBalancing -> Rep CrossZoneLoadBalancing x)
-> (forall x.
    Rep CrossZoneLoadBalancing x -> CrossZoneLoadBalancing)
-> Generic CrossZoneLoadBalancing
forall x. Rep CrossZoneLoadBalancing x -> CrossZoneLoadBalancing
forall x. CrossZoneLoadBalancing -> Rep CrossZoneLoadBalancing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CrossZoneLoadBalancing x -> CrossZoneLoadBalancing
$cfrom :: forall x. CrossZoneLoadBalancing -> Rep CrossZoneLoadBalancing x
Prelude.Generic)

-- |
-- Create a value of 'CrossZoneLoadBalancing' 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:
--
-- 'enabled', 'crossZoneLoadBalancing_enabled' - Specifies whether cross-zone load balancing is enabled for the load
-- balancer.
newCrossZoneLoadBalancing ::
  -- | 'enabled'
  Prelude.Bool ->
  CrossZoneLoadBalancing
newCrossZoneLoadBalancing :: Bool -> CrossZoneLoadBalancing
newCrossZoneLoadBalancing Bool
pEnabled_ =
  CrossZoneLoadBalancing' :: Bool -> CrossZoneLoadBalancing
CrossZoneLoadBalancing' {$sel:enabled:CrossZoneLoadBalancing' :: Bool
enabled = Bool
pEnabled_}

-- | Specifies whether cross-zone load balancing is enabled for the load
-- balancer.
crossZoneLoadBalancing_enabled :: Lens.Lens' CrossZoneLoadBalancing Prelude.Bool
crossZoneLoadBalancing_enabled :: (Bool -> f Bool)
-> CrossZoneLoadBalancing -> f CrossZoneLoadBalancing
crossZoneLoadBalancing_enabled = (CrossZoneLoadBalancing -> Bool)
-> (CrossZoneLoadBalancing -> Bool -> CrossZoneLoadBalancing)
-> Lens CrossZoneLoadBalancing CrossZoneLoadBalancing Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrossZoneLoadBalancing' {Bool
enabled :: Bool
$sel:enabled:CrossZoneLoadBalancing' :: CrossZoneLoadBalancing -> Bool
enabled} -> Bool
enabled) (\s :: CrossZoneLoadBalancing
s@CrossZoneLoadBalancing' {} Bool
a -> CrossZoneLoadBalancing
s {$sel:enabled:CrossZoneLoadBalancing' :: Bool
enabled = Bool
a} :: CrossZoneLoadBalancing)

instance Core.FromXML CrossZoneLoadBalancing where
  parseXML :: [Node] -> Either String CrossZoneLoadBalancing
parseXML [Node]
x =
    Bool -> CrossZoneLoadBalancing
CrossZoneLoadBalancing'
      (Bool -> CrossZoneLoadBalancing)
-> Either String Bool -> Either String CrossZoneLoadBalancing
forall (f :: * -> *) a b. Functor 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
"Enabled")

instance Prelude.Hashable CrossZoneLoadBalancing

instance Prelude.NFData CrossZoneLoadBalancing

instance Core.ToQuery CrossZoneLoadBalancing where
  toQuery :: CrossZoneLoadBalancing -> QueryString
toQuery CrossZoneLoadBalancing' {Bool
enabled :: Bool
$sel:enabled:CrossZoneLoadBalancing' :: CrossZoneLoadBalancing -> Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"Enabled" ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Bool
enabled]