{-# 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.EC2.Types.NatGatewayAddress
-- 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.EC2.Types.NatGatewayAddress where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Describes the IP addresses and network interface associated with a NAT
-- gateway.
--
-- /See:/ 'newNatGatewayAddress' smart constructor.
data NatGatewayAddress = NatGatewayAddress'
  { -- | [Public NAT gateway only] The allocation ID of the Elastic IP address
    -- that\'s associated with the NAT gateway.
    NatGatewayAddress -> Maybe Text
allocationId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the network interface associated with the NAT gateway.
    NatGatewayAddress -> Maybe Text
networkInterfaceId :: Prelude.Maybe Prelude.Text,
    -- | The private IP address associated with the NAT gateway.
    NatGatewayAddress -> Maybe Text
privateIp :: Prelude.Maybe Prelude.Text,
    -- | [Public NAT gateway only] The Elastic IP address associated with the NAT
    -- gateway.
    NatGatewayAddress -> Maybe Text
publicIp :: Prelude.Maybe Prelude.Text
  }
  deriving (NatGatewayAddress -> NatGatewayAddress -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NatGatewayAddress -> NatGatewayAddress -> Bool
$c/= :: NatGatewayAddress -> NatGatewayAddress -> Bool
== :: NatGatewayAddress -> NatGatewayAddress -> Bool
$c== :: NatGatewayAddress -> NatGatewayAddress -> Bool
Prelude.Eq, ReadPrec [NatGatewayAddress]
ReadPrec NatGatewayAddress
Int -> ReadS NatGatewayAddress
ReadS [NatGatewayAddress]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NatGatewayAddress]
$creadListPrec :: ReadPrec [NatGatewayAddress]
readPrec :: ReadPrec NatGatewayAddress
$creadPrec :: ReadPrec NatGatewayAddress
readList :: ReadS [NatGatewayAddress]
$creadList :: ReadS [NatGatewayAddress]
readsPrec :: Int -> ReadS NatGatewayAddress
$creadsPrec :: Int -> ReadS NatGatewayAddress
Prelude.Read, Int -> NatGatewayAddress -> ShowS
[NatGatewayAddress] -> ShowS
NatGatewayAddress -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NatGatewayAddress] -> ShowS
$cshowList :: [NatGatewayAddress] -> ShowS
show :: NatGatewayAddress -> String
$cshow :: NatGatewayAddress -> String
showsPrec :: Int -> NatGatewayAddress -> ShowS
$cshowsPrec :: Int -> NatGatewayAddress -> ShowS
Prelude.Show, forall x. Rep NatGatewayAddress x -> NatGatewayAddress
forall x. NatGatewayAddress -> Rep NatGatewayAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NatGatewayAddress x -> NatGatewayAddress
$cfrom :: forall x. NatGatewayAddress -> Rep NatGatewayAddress x
Prelude.Generic)

-- |
-- Create a value of 'NatGatewayAddress' 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:
--
-- 'allocationId', 'natGatewayAddress_allocationId' - [Public NAT gateway only] The allocation ID of the Elastic IP address
-- that\'s associated with the NAT gateway.
--
-- 'networkInterfaceId', 'natGatewayAddress_networkInterfaceId' - The ID of the network interface associated with the NAT gateway.
--
-- 'privateIp', 'natGatewayAddress_privateIp' - The private IP address associated with the NAT gateway.
--
-- 'publicIp', 'natGatewayAddress_publicIp' - [Public NAT gateway only] The Elastic IP address associated with the NAT
-- gateway.
newNatGatewayAddress ::
  NatGatewayAddress
newNatGatewayAddress :: NatGatewayAddress
newNatGatewayAddress =
  NatGatewayAddress'
    { $sel:allocationId:NatGatewayAddress' :: Maybe Text
allocationId = forall a. Maybe a
Prelude.Nothing,
      $sel:networkInterfaceId:NatGatewayAddress' :: Maybe Text
networkInterfaceId = forall a. Maybe a
Prelude.Nothing,
      $sel:privateIp:NatGatewayAddress' :: Maybe Text
privateIp = forall a. Maybe a
Prelude.Nothing,
      $sel:publicIp:NatGatewayAddress' :: Maybe Text
publicIp = forall a. Maybe a
Prelude.Nothing
    }

-- | [Public NAT gateway only] The allocation ID of the Elastic IP address
-- that\'s associated with the NAT gateway.
natGatewayAddress_allocationId :: Lens.Lens' NatGatewayAddress (Prelude.Maybe Prelude.Text)
natGatewayAddress_allocationId :: Lens' NatGatewayAddress (Maybe Text)
natGatewayAddress_allocationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NatGatewayAddress' {Maybe Text
allocationId :: Maybe Text
$sel:allocationId:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
allocationId} -> Maybe Text
allocationId) (\s :: NatGatewayAddress
s@NatGatewayAddress' {} Maybe Text
a -> NatGatewayAddress
s {$sel:allocationId:NatGatewayAddress' :: Maybe Text
allocationId = Maybe Text
a} :: NatGatewayAddress)

-- | The ID of the network interface associated with the NAT gateway.
natGatewayAddress_networkInterfaceId :: Lens.Lens' NatGatewayAddress (Prelude.Maybe Prelude.Text)
natGatewayAddress_networkInterfaceId :: Lens' NatGatewayAddress (Maybe Text)
natGatewayAddress_networkInterfaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NatGatewayAddress' {Maybe Text
networkInterfaceId :: Maybe Text
$sel:networkInterfaceId:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
networkInterfaceId} -> Maybe Text
networkInterfaceId) (\s :: NatGatewayAddress
s@NatGatewayAddress' {} Maybe Text
a -> NatGatewayAddress
s {$sel:networkInterfaceId:NatGatewayAddress' :: Maybe Text
networkInterfaceId = Maybe Text
a} :: NatGatewayAddress)

-- | The private IP address associated with the NAT gateway.
natGatewayAddress_privateIp :: Lens.Lens' NatGatewayAddress (Prelude.Maybe Prelude.Text)
natGatewayAddress_privateIp :: Lens' NatGatewayAddress (Maybe Text)
natGatewayAddress_privateIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NatGatewayAddress' {Maybe Text
privateIp :: Maybe Text
$sel:privateIp:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
privateIp} -> Maybe Text
privateIp) (\s :: NatGatewayAddress
s@NatGatewayAddress' {} Maybe Text
a -> NatGatewayAddress
s {$sel:privateIp:NatGatewayAddress' :: Maybe Text
privateIp = Maybe Text
a} :: NatGatewayAddress)

-- | [Public NAT gateway only] The Elastic IP address associated with the NAT
-- gateway.
natGatewayAddress_publicIp :: Lens.Lens' NatGatewayAddress (Prelude.Maybe Prelude.Text)
natGatewayAddress_publicIp :: Lens' NatGatewayAddress (Maybe Text)
natGatewayAddress_publicIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NatGatewayAddress' {Maybe Text
publicIp :: Maybe Text
$sel:publicIp:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
publicIp} -> Maybe Text
publicIp) (\s :: NatGatewayAddress
s@NatGatewayAddress' {} Maybe Text
a -> NatGatewayAddress
s {$sel:publicIp:NatGatewayAddress' :: Maybe Text
publicIp = Maybe Text
a} :: NatGatewayAddress)

instance Data.FromXML NatGatewayAddress where
  parseXML :: [Node] -> Either String NatGatewayAddress
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> NatGatewayAddress
NatGatewayAddress'
      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
"allocationId")
      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
"networkInterfaceId")
      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
"privateIp")
      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
"publicIp")

instance Prelude.Hashable NatGatewayAddress where
  hashWithSalt :: Int -> NatGatewayAddress -> Int
hashWithSalt Int
_salt NatGatewayAddress' {Maybe Text
publicIp :: Maybe Text
privateIp :: Maybe Text
networkInterfaceId :: Maybe Text
allocationId :: Maybe Text
$sel:publicIp:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
$sel:privateIp:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
$sel:networkInterfaceId:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
$sel:allocationId:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
allocationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkInterfaceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
privateIp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publicIp

instance Prelude.NFData NatGatewayAddress where
  rnf :: NatGatewayAddress -> ()
rnf NatGatewayAddress' {Maybe Text
publicIp :: Maybe Text
privateIp :: Maybe Text
networkInterfaceId :: Maybe Text
allocationId :: Maybe Text
$sel:publicIp:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
$sel:privateIp:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
$sel:networkInterfaceId:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
$sel:allocationId:NatGatewayAddress' :: NatGatewayAddress -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
allocationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkInterfaceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
privateIp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publicIp