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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ELBV2.Types.LoadBalancerAddress
import qualified Amazonka.Prelude as Prelude

-- | Information about an Availability Zone.
--
-- /See:/ 'newAvailabilityZone' smart constructor.
data AvailabilityZone = AvailabilityZone'
  { -- | [Network Load Balancers] If you need static IP addresses for your load
    -- balancer, you can specify one Elastic IP address per Availability Zone
    -- when you create an internal-facing load balancer. For internal load
    -- balancers, you can specify a private IP address from the IPv4 range of
    -- the subnet.
    AvailabilityZone -> Maybe [LoadBalancerAddress]
loadBalancerAddresses :: Prelude.Maybe [LoadBalancerAddress],
    -- | [Application Load Balancers on Outposts] The ID of the Outpost.
    AvailabilityZone -> Maybe Text
outpostId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the subnet. You can specify one subnet per Availability Zone.
    AvailabilityZone -> Maybe Text
subnetId :: Prelude.Maybe Prelude.Text,
    -- | The name of the Availability Zone.
    AvailabilityZone -> Maybe Text
zoneName :: Prelude.Maybe Prelude.Text
  }
  deriving (AvailabilityZone -> AvailabilityZone -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AvailabilityZone -> AvailabilityZone -> Bool
$c/= :: AvailabilityZone -> AvailabilityZone -> Bool
== :: AvailabilityZone -> AvailabilityZone -> Bool
$c== :: AvailabilityZone -> AvailabilityZone -> Bool
Prelude.Eq, ReadPrec [AvailabilityZone]
ReadPrec AvailabilityZone
Int -> ReadS AvailabilityZone
ReadS [AvailabilityZone]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AvailabilityZone]
$creadListPrec :: ReadPrec [AvailabilityZone]
readPrec :: ReadPrec AvailabilityZone
$creadPrec :: ReadPrec AvailabilityZone
readList :: ReadS [AvailabilityZone]
$creadList :: ReadS [AvailabilityZone]
readsPrec :: Int -> ReadS AvailabilityZone
$creadsPrec :: Int -> ReadS AvailabilityZone
Prelude.Read, Int -> AvailabilityZone -> ShowS
[AvailabilityZone] -> ShowS
AvailabilityZone -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AvailabilityZone] -> ShowS
$cshowList :: [AvailabilityZone] -> ShowS
show :: AvailabilityZone -> String
$cshow :: AvailabilityZone -> String
showsPrec :: Int -> AvailabilityZone -> ShowS
$cshowsPrec :: Int -> AvailabilityZone -> ShowS
Prelude.Show, forall x. Rep AvailabilityZone x -> AvailabilityZone
forall x. AvailabilityZone -> Rep AvailabilityZone x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AvailabilityZone x -> AvailabilityZone
$cfrom :: forall x. AvailabilityZone -> Rep AvailabilityZone x
Prelude.Generic)

-- |
-- Create a value of 'AvailabilityZone' 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:
--
-- 'loadBalancerAddresses', 'availabilityZone_loadBalancerAddresses' - [Network Load Balancers] If you need static IP addresses for your load
-- balancer, you can specify one Elastic IP address per Availability Zone
-- when you create an internal-facing load balancer. For internal load
-- balancers, you can specify a private IP address from the IPv4 range of
-- the subnet.
--
-- 'outpostId', 'availabilityZone_outpostId' - [Application Load Balancers on Outposts] The ID of the Outpost.
--
-- 'subnetId', 'availabilityZone_subnetId' - The ID of the subnet. You can specify one subnet per Availability Zone.
--
-- 'zoneName', 'availabilityZone_zoneName' - The name of the Availability Zone.
newAvailabilityZone ::
  AvailabilityZone
newAvailabilityZone :: AvailabilityZone
newAvailabilityZone =
  AvailabilityZone'
    { $sel:loadBalancerAddresses:AvailabilityZone' :: Maybe [LoadBalancerAddress]
loadBalancerAddresses =
        forall a. Maybe a
Prelude.Nothing,
      $sel:outpostId:AvailabilityZone' :: Maybe Text
outpostId = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetId:AvailabilityZone' :: Maybe Text
subnetId = forall a. Maybe a
Prelude.Nothing,
      $sel:zoneName:AvailabilityZone' :: Maybe Text
zoneName = forall a. Maybe a
Prelude.Nothing
    }

-- | [Network Load Balancers] If you need static IP addresses for your load
-- balancer, you can specify one Elastic IP address per Availability Zone
-- when you create an internal-facing load balancer. For internal load
-- balancers, you can specify a private IP address from the IPv4 range of
-- the subnet.
availabilityZone_loadBalancerAddresses :: Lens.Lens' AvailabilityZone (Prelude.Maybe [LoadBalancerAddress])
availabilityZone_loadBalancerAddresses :: Lens' AvailabilityZone (Maybe [LoadBalancerAddress])
availabilityZone_loadBalancerAddresses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityZone' {Maybe [LoadBalancerAddress]
loadBalancerAddresses :: Maybe [LoadBalancerAddress]
$sel:loadBalancerAddresses:AvailabilityZone' :: AvailabilityZone -> Maybe [LoadBalancerAddress]
loadBalancerAddresses} -> Maybe [LoadBalancerAddress]
loadBalancerAddresses) (\s :: AvailabilityZone
s@AvailabilityZone' {} Maybe [LoadBalancerAddress]
a -> AvailabilityZone
s {$sel:loadBalancerAddresses:AvailabilityZone' :: Maybe [LoadBalancerAddress]
loadBalancerAddresses = Maybe [LoadBalancerAddress]
a} :: AvailabilityZone) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | [Application Load Balancers on Outposts] The ID of the Outpost.
availabilityZone_outpostId :: Lens.Lens' AvailabilityZone (Prelude.Maybe Prelude.Text)
availabilityZone_outpostId :: Lens' AvailabilityZone (Maybe Text)
availabilityZone_outpostId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityZone' {Maybe Text
outpostId :: Maybe Text
$sel:outpostId:AvailabilityZone' :: AvailabilityZone -> Maybe Text
outpostId} -> Maybe Text
outpostId) (\s :: AvailabilityZone
s@AvailabilityZone' {} Maybe Text
a -> AvailabilityZone
s {$sel:outpostId:AvailabilityZone' :: Maybe Text
outpostId = Maybe Text
a} :: AvailabilityZone)

-- | The ID of the subnet. You can specify one subnet per Availability Zone.
availabilityZone_subnetId :: Lens.Lens' AvailabilityZone (Prelude.Maybe Prelude.Text)
availabilityZone_subnetId :: Lens' AvailabilityZone (Maybe Text)
availabilityZone_subnetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityZone' {Maybe Text
subnetId :: Maybe Text
$sel:subnetId:AvailabilityZone' :: AvailabilityZone -> Maybe Text
subnetId} -> Maybe Text
subnetId) (\s :: AvailabilityZone
s@AvailabilityZone' {} Maybe Text
a -> AvailabilityZone
s {$sel:subnetId:AvailabilityZone' :: Maybe Text
subnetId = Maybe Text
a} :: AvailabilityZone)

-- | The name of the Availability Zone.
availabilityZone_zoneName :: Lens.Lens' AvailabilityZone (Prelude.Maybe Prelude.Text)
availabilityZone_zoneName :: Lens' AvailabilityZone (Maybe Text)
availabilityZone_zoneName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailabilityZone' {Maybe Text
zoneName :: Maybe Text
$sel:zoneName:AvailabilityZone' :: AvailabilityZone -> Maybe Text
zoneName} -> Maybe Text
zoneName) (\s :: AvailabilityZone
s@AvailabilityZone' {} Maybe Text
a -> AvailabilityZone
s {$sel:zoneName:AvailabilityZone' :: Maybe Text
zoneName = Maybe Text
a} :: AvailabilityZone)

instance Data.FromXML AvailabilityZone where
  parseXML :: [Node] -> Either String AvailabilityZone
parseXML [Node]
x =
    Maybe [LoadBalancerAddress]
-> Maybe Text -> Maybe Text -> Maybe Text -> AvailabilityZone
AvailabilityZone'
      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
"LoadBalancerAddresses"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                  )
      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
"OutpostId")
      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
"SubnetId")
      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
"ZoneName")

instance Prelude.Hashable AvailabilityZone where
  hashWithSalt :: Int -> AvailabilityZone -> Int
hashWithSalt Int
_salt AvailabilityZone' {Maybe [LoadBalancerAddress]
Maybe Text
zoneName :: Maybe Text
subnetId :: Maybe Text
outpostId :: Maybe Text
loadBalancerAddresses :: Maybe [LoadBalancerAddress]
$sel:zoneName:AvailabilityZone' :: AvailabilityZone -> Maybe Text
$sel:subnetId:AvailabilityZone' :: AvailabilityZone -> Maybe Text
$sel:outpostId:AvailabilityZone' :: AvailabilityZone -> Maybe Text
$sel:loadBalancerAddresses:AvailabilityZone' :: AvailabilityZone -> Maybe [LoadBalancerAddress]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LoadBalancerAddress]
loadBalancerAddresses
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outpostId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subnetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
zoneName

instance Prelude.NFData AvailabilityZone where
  rnf :: AvailabilityZone -> ()
rnf AvailabilityZone' {Maybe [LoadBalancerAddress]
Maybe Text
zoneName :: Maybe Text
subnetId :: Maybe Text
outpostId :: Maybe Text
loadBalancerAddresses :: Maybe [LoadBalancerAddress]
$sel:zoneName:AvailabilityZone' :: AvailabilityZone -> Maybe Text
$sel:subnetId:AvailabilityZone' :: AvailabilityZone -> Maybe Text
$sel:outpostId:AvailabilityZone' :: AvailabilityZone -> Maybe Text
$sel:loadBalancerAddresses:AvailabilityZone' :: AvailabilityZone -> Maybe [LoadBalancerAddress]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [LoadBalancerAddress]
loadBalancerAddresses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outpostId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subnetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
zoneName