{-# 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.NetworkInterfacePrivateIpAddress
-- 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.NetworkInterfacePrivateIpAddress 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 Amazonka.EC2.Types.NetworkInterfaceAssociation
import qualified Amazonka.Prelude as Prelude

-- | Describes the private IPv4 address of a network interface.
--
-- /See:/ 'newNetworkInterfacePrivateIpAddress' smart constructor.
data NetworkInterfacePrivateIpAddress = NetworkInterfacePrivateIpAddress'
  { -- | The association information for an Elastic IP address (IPv4) associated
    -- with the network interface.
    NetworkInterfacePrivateIpAddress
-> Maybe NetworkInterfaceAssociation
association :: Prelude.Maybe NetworkInterfaceAssociation,
    -- | Indicates whether this IPv4 address is the primary private IPv4 address
    -- of the network interface.
    NetworkInterfacePrivateIpAddress -> Maybe Bool
primary :: Prelude.Maybe Prelude.Bool,
    -- | The private DNS name.
    NetworkInterfacePrivateIpAddress -> Maybe Text
privateDnsName :: Prelude.Maybe Prelude.Text,
    -- | The private IPv4 address.
    NetworkInterfacePrivateIpAddress -> Maybe Text
privateIpAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkInterfacePrivateIpAddress
-> NetworkInterfacePrivateIpAddress -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkInterfacePrivateIpAddress
-> NetworkInterfacePrivateIpAddress -> Bool
$c/= :: NetworkInterfacePrivateIpAddress
-> NetworkInterfacePrivateIpAddress -> Bool
== :: NetworkInterfacePrivateIpAddress
-> NetworkInterfacePrivateIpAddress -> Bool
$c== :: NetworkInterfacePrivateIpAddress
-> NetworkInterfacePrivateIpAddress -> Bool
Prelude.Eq, ReadPrec [NetworkInterfacePrivateIpAddress]
ReadPrec NetworkInterfacePrivateIpAddress
Int -> ReadS NetworkInterfacePrivateIpAddress
ReadS [NetworkInterfacePrivateIpAddress]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkInterfacePrivateIpAddress]
$creadListPrec :: ReadPrec [NetworkInterfacePrivateIpAddress]
readPrec :: ReadPrec NetworkInterfacePrivateIpAddress
$creadPrec :: ReadPrec NetworkInterfacePrivateIpAddress
readList :: ReadS [NetworkInterfacePrivateIpAddress]
$creadList :: ReadS [NetworkInterfacePrivateIpAddress]
readsPrec :: Int -> ReadS NetworkInterfacePrivateIpAddress
$creadsPrec :: Int -> ReadS NetworkInterfacePrivateIpAddress
Prelude.Read, Int -> NetworkInterfacePrivateIpAddress -> ShowS
[NetworkInterfacePrivateIpAddress] -> ShowS
NetworkInterfacePrivateIpAddress -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkInterfacePrivateIpAddress] -> ShowS
$cshowList :: [NetworkInterfacePrivateIpAddress] -> ShowS
show :: NetworkInterfacePrivateIpAddress -> String
$cshow :: NetworkInterfacePrivateIpAddress -> String
showsPrec :: Int -> NetworkInterfacePrivateIpAddress -> ShowS
$cshowsPrec :: Int -> NetworkInterfacePrivateIpAddress -> ShowS
Prelude.Show, forall x.
Rep NetworkInterfacePrivateIpAddress x
-> NetworkInterfacePrivateIpAddress
forall x.
NetworkInterfacePrivateIpAddress
-> Rep NetworkInterfacePrivateIpAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkInterfacePrivateIpAddress x
-> NetworkInterfacePrivateIpAddress
$cfrom :: forall x.
NetworkInterfacePrivateIpAddress
-> Rep NetworkInterfacePrivateIpAddress x
Prelude.Generic)

-- |
-- Create a value of 'NetworkInterfacePrivateIpAddress' 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:
--
-- 'association', 'networkInterfacePrivateIpAddress_association' - The association information for an Elastic IP address (IPv4) associated
-- with the network interface.
--
-- 'primary', 'networkInterfacePrivateIpAddress_primary' - Indicates whether this IPv4 address is the primary private IPv4 address
-- of the network interface.
--
-- 'privateDnsName', 'networkInterfacePrivateIpAddress_privateDnsName' - The private DNS name.
--
-- 'privateIpAddress', 'networkInterfacePrivateIpAddress_privateIpAddress' - The private IPv4 address.
newNetworkInterfacePrivateIpAddress ::
  NetworkInterfacePrivateIpAddress
newNetworkInterfacePrivateIpAddress :: NetworkInterfacePrivateIpAddress
newNetworkInterfacePrivateIpAddress =
  NetworkInterfacePrivateIpAddress'
    { $sel:association:NetworkInterfacePrivateIpAddress' :: Maybe NetworkInterfaceAssociation
association =
        forall a. Maybe a
Prelude.Nothing,
      $sel:primary:NetworkInterfacePrivateIpAddress' :: Maybe Bool
primary = forall a. Maybe a
Prelude.Nothing,
      $sel:privateDnsName:NetworkInterfacePrivateIpAddress' :: Maybe Text
privateDnsName = forall a. Maybe a
Prelude.Nothing,
      $sel:privateIpAddress:NetworkInterfacePrivateIpAddress' :: Maybe Text
privateIpAddress = forall a. Maybe a
Prelude.Nothing
    }

-- | The association information for an Elastic IP address (IPv4) associated
-- with the network interface.
networkInterfacePrivateIpAddress_association :: Lens.Lens' NetworkInterfacePrivateIpAddress (Prelude.Maybe NetworkInterfaceAssociation)
networkInterfacePrivateIpAddress_association :: Lens'
  NetworkInterfacePrivateIpAddress
  (Maybe NetworkInterfaceAssociation)
networkInterfacePrivateIpAddress_association = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfacePrivateIpAddress' {Maybe NetworkInterfaceAssociation
association :: Maybe NetworkInterfaceAssociation
$sel:association:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress
-> Maybe NetworkInterfaceAssociation
association} -> Maybe NetworkInterfaceAssociation
association) (\s :: NetworkInterfacePrivateIpAddress
s@NetworkInterfacePrivateIpAddress' {} Maybe NetworkInterfaceAssociation
a -> NetworkInterfacePrivateIpAddress
s {$sel:association:NetworkInterfacePrivateIpAddress' :: Maybe NetworkInterfaceAssociation
association = Maybe NetworkInterfaceAssociation
a} :: NetworkInterfacePrivateIpAddress)

-- | Indicates whether this IPv4 address is the primary private IPv4 address
-- of the network interface.
networkInterfacePrivateIpAddress_primary :: Lens.Lens' NetworkInterfacePrivateIpAddress (Prelude.Maybe Prelude.Bool)
networkInterfacePrivateIpAddress_primary :: Lens' NetworkInterfacePrivateIpAddress (Maybe Bool)
networkInterfacePrivateIpAddress_primary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfacePrivateIpAddress' {Maybe Bool
primary :: Maybe Bool
$sel:primary:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Bool
primary} -> Maybe Bool
primary) (\s :: NetworkInterfacePrivateIpAddress
s@NetworkInterfacePrivateIpAddress' {} Maybe Bool
a -> NetworkInterfacePrivateIpAddress
s {$sel:primary:NetworkInterfacePrivateIpAddress' :: Maybe Bool
primary = Maybe Bool
a} :: NetworkInterfacePrivateIpAddress)

-- | The private DNS name.
networkInterfacePrivateIpAddress_privateDnsName :: Lens.Lens' NetworkInterfacePrivateIpAddress (Prelude.Maybe Prelude.Text)
networkInterfacePrivateIpAddress_privateDnsName :: Lens' NetworkInterfacePrivateIpAddress (Maybe Text)
networkInterfacePrivateIpAddress_privateDnsName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfacePrivateIpAddress' {Maybe Text
privateDnsName :: Maybe Text
$sel:privateDnsName:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Text
privateDnsName} -> Maybe Text
privateDnsName) (\s :: NetworkInterfacePrivateIpAddress
s@NetworkInterfacePrivateIpAddress' {} Maybe Text
a -> NetworkInterfacePrivateIpAddress
s {$sel:privateDnsName:NetworkInterfacePrivateIpAddress' :: Maybe Text
privateDnsName = Maybe Text
a} :: NetworkInterfacePrivateIpAddress)

-- | The private IPv4 address.
networkInterfacePrivateIpAddress_privateIpAddress :: Lens.Lens' NetworkInterfacePrivateIpAddress (Prelude.Maybe Prelude.Text)
networkInterfacePrivateIpAddress_privateIpAddress :: Lens' NetworkInterfacePrivateIpAddress (Maybe Text)
networkInterfacePrivateIpAddress_privateIpAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterfacePrivateIpAddress' {Maybe Text
privateIpAddress :: Maybe Text
$sel:privateIpAddress:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Text
privateIpAddress} -> Maybe Text
privateIpAddress) (\s :: NetworkInterfacePrivateIpAddress
s@NetworkInterfacePrivateIpAddress' {} Maybe Text
a -> NetworkInterfacePrivateIpAddress
s {$sel:privateIpAddress:NetworkInterfacePrivateIpAddress' :: Maybe Text
privateIpAddress = Maybe Text
a} :: NetworkInterfacePrivateIpAddress)

instance
  Data.FromXML
    NetworkInterfacePrivateIpAddress
  where
  parseXML :: [Node] -> Either String NetworkInterfacePrivateIpAddress
parseXML [Node]
x =
    Maybe NetworkInterfaceAssociation
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> NetworkInterfacePrivateIpAddress
NetworkInterfacePrivateIpAddress'
      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
"association")
      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
"primary")
      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
"privateDnsName")
      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
"privateIpAddress")

instance
  Prelude.Hashable
    NetworkInterfacePrivateIpAddress
  where
  hashWithSalt :: Int -> NetworkInterfacePrivateIpAddress -> Int
hashWithSalt
    Int
_salt
    NetworkInterfacePrivateIpAddress' {Maybe Bool
Maybe Text
Maybe NetworkInterfaceAssociation
privateIpAddress :: Maybe Text
privateDnsName :: Maybe Text
primary :: Maybe Bool
association :: Maybe NetworkInterfaceAssociation
$sel:privateIpAddress:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Text
$sel:privateDnsName:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Text
$sel:primary:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Bool
$sel:association:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress
-> Maybe NetworkInterfaceAssociation
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NetworkInterfaceAssociation
association
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
primary
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
privateDnsName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
privateIpAddress

instance
  Prelude.NFData
    NetworkInterfacePrivateIpAddress
  where
  rnf :: NetworkInterfacePrivateIpAddress -> ()
rnf NetworkInterfacePrivateIpAddress' {Maybe Bool
Maybe Text
Maybe NetworkInterfaceAssociation
privateIpAddress :: Maybe Text
privateDnsName :: Maybe Text
primary :: Maybe Bool
association :: Maybe NetworkInterfaceAssociation
$sel:privateIpAddress:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Text
$sel:privateDnsName:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Text
$sel:primary:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress -> Maybe Bool
$sel:association:NetworkInterfacePrivateIpAddress' :: NetworkInterfacePrivateIpAddress
-> Maybe NetworkInterfaceAssociation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NetworkInterfaceAssociation
association
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
primary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
privateDnsName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
privateIpAddress