{-# 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.NetworkInterfaceAssociation
-- 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.NetworkInterfaceAssociation 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 association information for an Elastic IP address (IPv4 only),
-- or a Carrier IP address (for a network interface which resides in a
-- subnet in a Wavelength Zone).
--
-- /See:/ 'newNetworkInterfaceAssociation' smart constructor.
data NetworkInterfaceAssociation = NetworkInterfaceAssociation'
  { -- | The allocation ID.
    NetworkInterfaceAssociation -> Maybe Text
allocationId :: Prelude.Maybe Prelude.Text,
    -- | The association ID.
    NetworkInterfaceAssociation -> Maybe Text
associationId :: Prelude.Maybe Prelude.Text,
    -- | The carrier IP address associated with the network interface.
    --
    -- This option is only available when the network interface is in a subnet
    -- which is associated with a Wavelength Zone.
    NetworkInterfaceAssociation -> Maybe Text
carrierIp :: Prelude.Maybe Prelude.Text,
    -- | The customer-owned IP address associated with the network interface.
    NetworkInterfaceAssociation -> Maybe Text
customerOwnedIp :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Elastic IP address owner.
    NetworkInterfaceAssociation -> Maybe Text
ipOwnerId :: Prelude.Maybe Prelude.Text,
    -- | The public DNS name.
    NetworkInterfaceAssociation -> Maybe Text
publicDnsName :: Prelude.Maybe Prelude.Text,
    -- | The address of the Elastic IP address bound to the network interface.
    NetworkInterfaceAssociation -> Maybe Text
publicIp :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkInterfaceAssociation -> NetworkInterfaceAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkInterfaceAssociation -> NetworkInterfaceAssociation -> Bool
$c/= :: NetworkInterfaceAssociation -> NetworkInterfaceAssociation -> Bool
== :: NetworkInterfaceAssociation -> NetworkInterfaceAssociation -> Bool
$c== :: NetworkInterfaceAssociation -> NetworkInterfaceAssociation -> Bool
Prelude.Eq, ReadPrec [NetworkInterfaceAssociation]
ReadPrec NetworkInterfaceAssociation
Int -> ReadS NetworkInterfaceAssociation
ReadS [NetworkInterfaceAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkInterfaceAssociation]
$creadListPrec :: ReadPrec [NetworkInterfaceAssociation]
readPrec :: ReadPrec NetworkInterfaceAssociation
$creadPrec :: ReadPrec NetworkInterfaceAssociation
readList :: ReadS [NetworkInterfaceAssociation]
$creadList :: ReadS [NetworkInterfaceAssociation]
readsPrec :: Int -> ReadS NetworkInterfaceAssociation
$creadsPrec :: Int -> ReadS NetworkInterfaceAssociation
Prelude.Read, Int -> NetworkInterfaceAssociation -> ShowS
[NetworkInterfaceAssociation] -> ShowS
NetworkInterfaceAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkInterfaceAssociation] -> ShowS
$cshowList :: [NetworkInterfaceAssociation] -> ShowS
show :: NetworkInterfaceAssociation -> String
$cshow :: NetworkInterfaceAssociation -> String
showsPrec :: Int -> NetworkInterfaceAssociation -> ShowS
$cshowsPrec :: Int -> NetworkInterfaceAssociation -> ShowS
Prelude.Show, forall x.
Rep NetworkInterfaceAssociation x -> NetworkInterfaceAssociation
forall x.
NetworkInterfaceAssociation -> Rep NetworkInterfaceAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkInterfaceAssociation x -> NetworkInterfaceAssociation
$cfrom :: forall x.
NetworkInterfaceAssociation -> Rep NetworkInterfaceAssociation x
Prelude.Generic)

-- |
-- Create a value of 'NetworkInterfaceAssociation' 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', 'networkInterfaceAssociation_allocationId' - The allocation ID.
--
-- 'associationId', 'networkInterfaceAssociation_associationId' - The association ID.
--
-- 'carrierIp', 'networkInterfaceAssociation_carrierIp' - The carrier IP address associated with the network interface.
--
-- This option is only available when the network interface is in a subnet
-- which is associated with a Wavelength Zone.
--
-- 'customerOwnedIp', 'networkInterfaceAssociation_customerOwnedIp' - The customer-owned IP address associated with the network interface.
--
-- 'ipOwnerId', 'networkInterfaceAssociation_ipOwnerId' - The ID of the Elastic IP address owner.
--
-- 'publicDnsName', 'networkInterfaceAssociation_publicDnsName' - The public DNS name.
--
-- 'publicIp', 'networkInterfaceAssociation_publicIp' - The address of the Elastic IP address bound to the network interface.
newNetworkInterfaceAssociation ::
  NetworkInterfaceAssociation
newNetworkInterfaceAssociation :: NetworkInterfaceAssociation
newNetworkInterfaceAssociation =
  NetworkInterfaceAssociation'
    { $sel:allocationId:NetworkInterfaceAssociation' :: Maybe Text
allocationId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:associationId:NetworkInterfaceAssociation' :: Maybe Text
associationId = forall a. Maybe a
Prelude.Nothing,
      $sel:carrierIp:NetworkInterfaceAssociation' :: Maybe Text
carrierIp = forall a. Maybe a
Prelude.Nothing,
      $sel:customerOwnedIp:NetworkInterfaceAssociation' :: Maybe Text
customerOwnedIp = forall a. Maybe a
Prelude.Nothing,
      $sel:ipOwnerId:NetworkInterfaceAssociation' :: Maybe Text
ipOwnerId = forall a. Maybe a
Prelude.Nothing,
      $sel:publicDnsName:NetworkInterfaceAssociation' :: Maybe Text
publicDnsName = forall a. Maybe a
Prelude.Nothing,
      $sel:publicIp:NetworkInterfaceAssociation' :: Maybe Text
publicIp = forall a. Maybe a
Prelude.Nothing
    }

-- | The allocation ID.
networkInterfaceAssociation_allocationId :: Lens.Lens' NetworkInterfaceAssociation (Prelude.Maybe Prelude.Text)
networkInterfaceAssociation_allocationId :: Lens' NetworkInterfaceAssociation (Maybe Text)
networkInterfaceAssociation_allocationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfaceAssociation' {Maybe Text
allocationId :: Maybe Text
$sel:allocationId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
allocationId} -> Maybe Text
allocationId) (\s :: NetworkInterfaceAssociation
s@NetworkInterfaceAssociation' {} Maybe Text
a -> NetworkInterfaceAssociation
s {$sel:allocationId:NetworkInterfaceAssociation' :: Maybe Text
allocationId = Maybe Text
a} :: NetworkInterfaceAssociation)

-- | The association ID.
networkInterfaceAssociation_associationId :: Lens.Lens' NetworkInterfaceAssociation (Prelude.Maybe Prelude.Text)
networkInterfaceAssociation_associationId :: Lens' NetworkInterfaceAssociation (Maybe Text)
networkInterfaceAssociation_associationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfaceAssociation' {Maybe Text
associationId :: Maybe Text
$sel:associationId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
associationId} -> Maybe Text
associationId) (\s :: NetworkInterfaceAssociation
s@NetworkInterfaceAssociation' {} Maybe Text
a -> NetworkInterfaceAssociation
s {$sel:associationId:NetworkInterfaceAssociation' :: Maybe Text
associationId = Maybe Text
a} :: NetworkInterfaceAssociation)

-- | The carrier IP address associated with the network interface.
--
-- This option is only available when the network interface is in a subnet
-- which is associated with a Wavelength Zone.
networkInterfaceAssociation_carrierIp :: Lens.Lens' NetworkInterfaceAssociation (Prelude.Maybe Prelude.Text)
networkInterfaceAssociation_carrierIp :: Lens' NetworkInterfaceAssociation (Maybe Text)
networkInterfaceAssociation_carrierIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfaceAssociation' {Maybe Text
carrierIp :: Maybe Text
$sel:carrierIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
carrierIp} -> Maybe Text
carrierIp) (\s :: NetworkInterfaceAssociation
s@NetworkInterfaceAssociation' {} Maybe Text
a -> NetworkInterfaceAssociation
s {$sel:carrierIp:NetworkInterfaceAssociation' :: Maybe Text
carrierIp = Maybe Text
a} :: NetworkInterfaceAssociation)

-- | The customer-owned IP address associated with the network interface.
networkInterfaceAssociation_customerOwnedIp :: Lens.Lens' NetworkInterfaceAssociation (Prelude.Maybe Prelude.Text)
networkInterfaceAssociation_customerOwnedIp :: Lens' NetworkInterfaceAssociation (Maybe Text)
networkInterfaceAssociation_customerOwnedIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfaceAssociation' {Maybe Text
customerOwnedIp :: Maybe Text
$sel:customerOwnedIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
customerOwnedIp} -> Maybe Text
customerOwnedIp) (\s :: NetworkInterfaceAssociation
s@NetworkInterfaceAssociation' {} Maybe Text
a -> NetworkInterfaceAssociation
s {$sel:customerOwnedIp:NetworkInterfaceAssociation' :: Maybe Text
customerOwnedIp = Maybe Text
a} :: NetworkInterfaceAssociation)

-- | The ID of the Elastic IP address owner.
networkInterfaceAssociation_ipOwnerId :: Lens.Lens' NetworkInterfaceAssociation (Prelude.Maybe Prelude.Text)
networkInterfaceAssociation_ipOwnerId :: Lens' NetworkInterfaceAssociation (Maybe Text)
networkInterfaceAssociation_ipOwnerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfaceAssociation' {Maybe Text
ipOwnerId :: Maybe Text
$sel:ipOwnerId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
ipOwnerId} -> Maybe Text
ipOwnerId) (\s :: NetworkInterfaceAssociation
s@NetworkInterfaceAssociation' {} Maybe Text
a -> NetworkInterfaceAssociation
s {$sel:ipOwnerId:NetworkInterfaceAssociation' :: Maybe Text
ipOwnerId = Maybe Text
a} :: NetworkInterfaceAssociation)

-- | The public DNS name.
networkInterfaceAssociation_publicDnsName :: Lens.Lens' NetworkInterfaceAssociation (Prelude.Maybe Prelude.Text)
networkInterfaceAssociation_publicDnsName :: Lens' NetworkInterfaceAssociation (Maybe Text)
networkInterfaceAssociation_publicDnsName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfaceAssociation' {Maybe Text
publicDnsName :: Maybe Text
$sel:publicDnsName:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
publicDnsName} -> Maybe Text
publicDnsName) (\s :: NetworkInterfaceAssociation
s@NetworkInterfaceAssociation' {} Maybe Text
a -> NetworkInterfaceAssociation
s {$sel:publicDnsName:NetworkInterfaceAssociation' :: Maybe Text
publicDnsName = Maybe Text
a} :: NetworkInterfaceAssociation)

-- | The address of the Elastic IP address bound to the network interface.
networkInterfaceAssociation_publicIp :: Lens.Lens' NetworkInterfaceAssociation (Prelude.Maybe Prelude.Text)
networkInterfaceAssociation_publicIp :: Lens' NetworkInterfaceAssociation (Maybe Text)
networkInterfaceAssociation_publicIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfaceAssociation' {Maybe Text
publicIp :: Maybe Text
$sel:publicIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
publicIp} -> Maybe Text
publicIp) (\s :: NetworkInterfaceAssociation
s@NetworkInterfaceAssociation' {} Maybe Text
a -> NetworkInterfaceAssociation
s {$sel:publicIp:NetworkInterfaceAssociation' :: Maybe Text
publicIp = Maybe Text
a} :: NetworkInterfaceAssociation)

instance Data.FromXML NetworkInterfaceAssociation where
  parseXML :: [Node] -> Either String NetworkInterfaceAssociation
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> NetworkInterfaceAssociation
NetworkInterfaceAssociation'
      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
"associationId")
      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
"carrierIp")
      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
"customerOwnedIp")
      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
"ipOwnerId")
      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
"publicDnsName")
      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 NetworkInterfaceAssociation where
  hashWithSalt :: Int -> NetworkInterfaceAssociation -> Int
hashWithSalt Int
_salt NetworkInterfaceAssociation' {Maybe Text
publicIp :: Maybe Text
publicDnsName :: Maybe Text
ipOwnerId :: Maybe Text
customerOwnedIp :: Maybe Text
carrierIp :: Maybe Text
associationId :: Maybe Text
allocationId :: Maybe Text
$sel:publicIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:publicDnsName:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:ipOwnerId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:customerOwnedIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:carrierIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:associationId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:allocationId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> 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
associationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
carrierIp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customerOwnedIp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipOwnerId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publicDnsName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publicIp

instance Prelude.NFData NetworkInterfaceAssociation where
  rnf :: NetworkInterfaceAssociation -> ()
rnf NetworkInterfaceAssociation' {Maybe Text
publicIp :: Maybe Text
publicDnsName :: Maybe Text
ipOwnerId :: Maybe Text
customerOwnedIp :: Maybe Text
carrierIp :: Maybe Text
associationId :: Maybe Text
allocationId :: Maybe Text
$sel:publicIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:publicDnsName:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:ipOwnerId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:customerOwnedIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:carrierIp:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:associationId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> Maybe Text
$sel:allocationId:NetworkInterfaceAssociation' :: NetworkInterfaceAssociation -> 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
associationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
carrierIp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customerOwnedIp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipOwnerId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publicDnsName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publicIp