{-# 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.ELBV2.Types.LoadBalancerAddress
-- 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.ELBV2.Types.LoadBalancerAddress where

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

-- | Information about a static IP address for a load balancer.
--
-- /See:/ 'newLoadBalancerAddress' smart constructor.
data LoadBalancerAddress = LoadBalancerAddress'
  { -- | [Network Load Balancers] The IPv6 address.
    LoadBalancerAddress -> Maybe Text
iPv6Address :: Prelude.Maybe Prelude.Text,
    -- | The static IP address.
    LoadBalancerAddress -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | [Network Load Balancers] The allocation ID of the Elastic IP address for
    -- an internal-facing load balancer.
    LoadBalancerAddress -> Maybe Text
allocationId :: Prelude.Maybe Prelude.Text,
    -- | [Network Load Balancers] The private IPv4 address for an internal load
    -- balancer.
    LoadBalancerAddress -> Maybe Text
privateIPv4Address :: Prelude.Maybe Prelude.Text
  }
  deriving (LoadBalancerAddress -> LoadBalancerAddress -> Bool
(LoadBalancerAddress -> LoadBalancerAddress -> Bool)
-> (LoadBalancerAddress -> LoadBalancerAddress -> Bool)
-> Eq LoadBalancerAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoadBalancerAddress -> LoadBalancerAddress -> Bool
$c/= :: LoadBalancerAddress -> LoadBalancerAddress -> Bool
== :: LoadBalancerAddress -> LoadBalancerAddress -> Bool
$c== :: LoadBalancerAddress -> LoadBalancerAddress -> Bool
Prelude.Eq, ReadPrec [LoadBalancerAddress]
ReadPrec LoadBalancerAddress
Int -> ReadS LoadBalancerAddress
ReadS [LoadBalancerAddress]
(Int -> ReadS LoadBalancerAddress)
-> ReadS [LoadBalancerAddress]
-> ReadPrec LoadBalancerAddress
-> ReadPrec [LoadBalancerAddress]
-> Read LoadBalancerAddress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoadBalancerAddress]
$creadListPrec :: ReadPrec [LoadBalancerAddress]
readPrec :: ReadPrec LoadBalancerAddress
$creadPrec :: ReadPrec LoadBalancerAddress
readList :: ReadS [LoadBalancerAddress]
$creadList :: ReadS [LoadBalancerAddress]
readsPrec :: Int -> ReadS LoadBalancerAddress
$creadsPrec :: Int -> ReadS LoadBalancerAddress
Prelude.Read, Int -> LoadBalancerAddress -> ShowS
[LoadBalancerAddress] -> ShowS
LoadBalancerAddress -> String
(Int -> LoadBalancerAddress -> ShowS)
-> (LoadBalancerAddress -> String)
-> ([LoadBalancerAddress] -> ShowS)
-> Show LoadBalancerAddress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoadBalancerAddress] -> ShowS
$cshowList :: [LoadBalancerAddress] -> ShowS
show :: LoadBalancerAddress -> String
$cshow :: LoadBalancerAddress -> String
showsPrec :: Int -> LoadBalancerAddress -> ShowS
$cshowsPrec :: Int -> LoadBalancerAddress -> ShowS
Prelude.Show, (forall x. LoadBalancerAddress -> Rep LoadBalancerAddress x)
-> (forall x. Rep LoadBalancerAddress x -> LoadBalancerAddress)
-> Generic LoadBalancerAddress
forall x. Rep LoadBalancerAddress x -> LoadBalancerAddress
forall x. LoadBalancerAddress -> Rep LoadBalancerAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoadBalancerAddress x -> LoadBalancerAddress
$cfrom :: forall x. LoadBalancerAddress -> Rep LoadBalancerAddress x
Prelude.Generic)

-- |
-- Create a value of 'LoadBalancerAddress' 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:
--
-- 'iPv6Address', 'loadBalancerAddress_iPv6Address' - [Network Load Balancers] The IPv6 address.
--
-- 'ipAddress', 'loadBalancerAddress_ipAddress' - The static IP address.
--
-- 'allocationId', 'loadBalancerAddress_allocationId' - [Network Load Balancers] The allocation ID of the Elastic IP address for
-- an internal-facing load balancer.
--
-- 'privateIPv4Address', 'loadBalancerAddress_privateIPv4Address' - [Network Load Balancers] The private IPv4 address for an internal load
-- balancer.
newLoadBalancerAddress ::
  LoadBalancerAddress
newLoadBalancerAddress :: LoadBalancerAddress
newLoadBalancerAddress =
  LoadBalancerAddress' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> LoadBalancerAddress
LoadBalancerAddress'
    { $sel:iPv6Address:LoadBalancerAddress' :: Maybe Text
iPv6Address = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddress:LoadBalancerAddress' :: Maybe Text
ipAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:allocationId:LoadBalancerAddress' :: Maybe Text
allocationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:privateIPv4Address:LoadBalancerAddress' :: Maybe Text
privateIPv4Address = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | [Network Load Balancers] The IPv6 address.
loadBalancerAddress_iPv6Address :: Lens.Lens' LoadBalancerAddress (Prelude.Maybe Prelude.Text)
loadBalancerAddress_iPv6Address :: (Maybe Text -> f (Maybe Text))
-> LoadBalancerAddress -> f LoadBalancerAddress
loadBalancerAddress_iPv6Address = (LoadBalancerAddress -> Maybe Text)
-> (LoadBalancerAddress -> Maybe Text -> LoadBalancerAddress)
-> Lens
     LoadBalancerAddress LoadBalancerAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancerAddress' {Maybe Text
iPv6Address :: Maybe Text
$sel:iPv6Address:LoadBalancerAddress' :: LoadBalancerAddress -> Maybe Text
iPv6Address} -> Maybe Text
iPv6Address) (\s :: LoadBalancerAddress
s@LoadBalancerAddress' {} Maybe Text
a -> LoadBalancerAddress
s {$sel:iPv6Address:LoadBalancerAddress' :: Maybe Text
iPv6Address = Maybe Text
a} :: LoadBalancerAddress)

-- | The static IP address.
loadBalancerAddress_ipAddress :: Lens.Lens' LoadBalancerAddress (Prelude.Maybe Prelude.Text)
loadBalancerAddress_ipAddress :: (Maybe Text -> f (Maybe Text))
-> LoadBalancerAddress -> f LoadBalancerAddress
loadBalancerAddress_ipAddress = (LoadBalancerAddress -> Maybe Text)
-> (LoadBalancerAddress -> Maybe Text -> LoadBalancerAddress)
-> Lens
     LoadBalancerAddress LoadBalancerAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancerAddress' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:LoadBalancerAddress' :: LoadBalancerAddress -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: LoadBalancerAddress
s@LoadBalancerAddress' {} Maybe Text
a -> LoadBalancerAddress
s {$sel:ipAddress:LoadBalancerAddress' :: Maybe Text
ipAddress = Maybe Text
a} :: LoadBalancerAddress)

-- | [Network Load Balancers] The allocation ID of the Elastic IP address for
-- an internal-facing load balancer.
loadBalancerAddress_allocationId :: Lens.Lens' LoadBalancerAddress (Prelude.Maybe Prelude.Text)
loadBalancerAddress_allocationId :: (Maybe Text -> f (Maybe Text))
-> LoadBalancerAddress -> f LoadBalancerAddress
loadBalancerAddress_allocationId = (LoadBalancerAddress -> Maybe Text)
-> (LoadBalancerAddress -> Maybe Text -> LoadBalancerAddress)
-> Lens
     LoadBalancerAddress LoadBalancerAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancerAddress' {Maybe Text
allocationId :: Maybe Text
$sel:allocationId:LoadBalancerAddress' :: LoadBalancerAddress -> Maybe Text
allocationId} -> Maybe Text
allocationId) (\s :: LoadBalancerAddress
s@LoadBalancerAddress' {} Maybe Text
a -> LoadBalancerAddress
s {$sel:allocationId:LoadBalancerAddress' :: Maybe Text
allocationId = Maybe Text
a} :: LoadBalancerAddress)

-- | [Network Load Balancers] The private IPv4 address for an internal load
-- balancer.
loadBalancerAddress_privateIPv4Address :: Lens.Lens' LoadBalancerAddress (Prelude.Maybe Prelude.Text)
loadBalancerAddress_privateIPv4Address :: (Maybe Text -> f (Maybe Text))
-> LoadBalancerAddress -> f LoadBalancerAddress
loadBalancerAddress_privateIPv4Address = (LoadBalancerAddress -> Maybe Text)
-> (LoadBalancerAddress -> Maybe Text -> LoadBalancerAddress)
-> Lens
     LoadBalancerAddress LoadBalancerAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancerAddress' {Maybe Text
privateIPv4Address :: Maybe Text
$sel:privateIPv4Address:LoadBalancerAddress' :: LoadBalancerAddress -> Maybe Text
privateIPv4Address} -> Maybe Text
privateIPv4Address) (\s :: LoadBalancerAddress
s@LoadBalancerAddress' {} Maybe Text
a -> LoadBalancerAddress
s {$sel:privateIPv4Address:LoadBalancerAddress' :: Maybe Text
privateIPv4Address = Maybe Text
a} :: LoadBalancerAddress)

instance Core.FromXML LoadBalancerAddress where
  parseXML :: [Node] -> Either String LoadBalancerAddress
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> LoadBalancerAddress
LoadBalancerAddress'
      (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> LoadBalancerAddress)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Text -> Maybe Text -> LoadBalancerAddress)
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
"IPv6Address")
      Either
  String
  (Maybe Text -> Maybe Text -> Maybe Text -> LoadBalancerAddress)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> LoadBalancerAddress)
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
"IpAddress")
      Either String (Maybe Text -> Maybe Text -> LoadBalancerAddress)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> LoadBalancerAddress)
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
"AllocationId")
      Either String (Maybe Text -> LoadBalancerAddress)
-> Either String (Maybe Text) -> Either String LoadBalancerAddress
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
"PrivateIPv4Address")

instance Prelude.Hashable LoadBalancerAddress

instance Prelude.NFData LoadBalancerAddress