{-# 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.InstancePrivateIpAddress
-- 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.InstancePrivateIpAddress 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.InstanceNetworkInterfaceAssociation
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'InstancePrivateIpAddress' 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', 'instancePrivateIpAddress_association' - The association information for an Elastic IP address for the network
-- interface.
--
-- 'primary', 'instancePrivateIpAddress_primary' - Indicates whether this IPv4 address is the primary private IP address of
-- the network interface.
--
-- 'privateDnsName', 'instancePrivateIpAddress_privateDnsName' - The private IPv4 DNS name.
--
-- 'privateIpAddress', 'instancePrivateIpAddress_privateIpAddress' - The private IPv4 address of the network interface.
newInstancePrivateIpAddress ::
  InstancePrivateIpAddress
newInstancePrivateIpAddress :: InstancePrivateIpAddress
newInstancePrivateIpAddress =
  InstancePrivateIpAddress'
    { $sel:association:InstancePrivateIpAddress' :: Maybe InstanceNetworkInterfaceAssociation
association =
        forall a. Maybe a
Prelude.Nothing,
      $sel:primary:InstancePrivateIpAddress' :: Maybe Bool
primary = forall a. Maybe a
Prelude.Nothing,
      $sel:privateDnsName:InstancePrivateIpAddress' :: Maybe Text
privateDnsName = forall a. Maybe a
Prelude.Nothing,
      $sel:privateIpAddress:InstancePrivateIpAddress' :: Maybe Text
privateIpAddress = forall a. Maybe a
Prelude.Nothing
    }

-- | The association information for an Elastic IP address for the network
-- interface.
instancePrivateIpAddress_association :: Lens.Lens' InstancePrivateIpAddress (Prelude.Maybe InstanceNetworkInterfaceAssociation)
instancePrivateIpAddress_association :: Lens'
  InstancePrivateIpAddress
  (Maybe InstanceNetworkInterfaceAssociation)
instancePrivateIpAddress_association = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePrivateIpAddress' {Maybe InstanceNetworkInterfaceAssociation
association :: Maybe InstanceNetworkInterfaceAssociation
$sel:association:InstancePrivateIpAddress' :: InstancePrivateIpAddress
-> Maybe InstanceNetworkInterfaceAssociation
association} -> Maybe InstanceNetworkInterfaceAssociation
association) (\s :: InstancePrivateIpAddress
s@InstancePrivateIpAddress' {} Maybe InstanceNetworkInterfaceAssociation
a -> InstancePrivateIpAddress
s {$sel:association:InstancePrivateIpAddress' :: Maybe InstanceNetworkInterfaceAssociation
association = Maybe InstanceNetworkInterfaceAssociation
a} :: InstancePrivateIpAddress)

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

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

-- | The private IPv4 address of the network interface.
instancePrivateIpAddress_privateIpAddress :: Lens.Lens' InstancePrivateIpAddress (Prelude.Maybe Prelude.Text)
instancePrivateIpAddress_privateIpAddress :: Lens' InstancePrivateIpAddress (Maybe Text)
instancePrivateIpAddress_privateIpAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePrivateIpAddress' {Maybe Text
privateIpAddress :: Maybe Text
$sel:privateIpAddress:InstancePrivateIpAddress' :: InstancePrivateIpAddress -> Maybe Text
privateIpAddress} -> Maybe Text
privateIpAddress) (\s :: InstancePrivateIpAddress
s@InstancePrivateIpAddress' {} Maybe Text
a -> InstancePrivateIpAddress
s {$sel:privateIpAddress:InstancePrivateIpAddress' :: Maybe Text
privateIpAddress = Maybe Text
a} :: InstancePrivateIpAddress)

instance Data.FromXML InstancePrivateIpAddress where
  parseXML :: [Node] -> Either String InstancePrivateIpAddress
parseXML [Node]
x =
    Maybe InstanceNetworkInterfaceAssociation
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> InstancePrivateIpAddress
InstancePrivateIpAddress'
      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 InstancePrivateIpAddress where
  hashWithSalt :: Int -> InstancePrivateIpAddress -> Int
hashWithSalt Int
_salt InstancePrivateIpAddress' {Maybe Bool
Maybe Text
Maybe InstanceNetworkInterfaceAssociation
privateIpAddress :: Maybe Text
privateDnsName :: Maybe Text
primary :: Maybe Bool
association :: Maybe InstanceNetworkInterfaceAssociation
$sel:privateIpAddress:InstancePrivateIpAddress' :: InstancePrivateIpAddress -> Maybe Text
$sel:privateDnsName:InstancePrivateIpAddress' :: InstancePrivateIpAddress -> Maybe Text
$sel:primary:InstancePrivateIpAddress' :: InstancePrivateIpAddress -> Maybe Bool
$sel:association:InstancePrivateIpAddress' :: InstancePrivateIpAddress
-> Maybe InstanceNetworkInterfaceAssociation
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceNetworkInterfaceAssociation
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 InstancePrivateIpAddress where
  rnf :: InstancePrivateIpAddress -> ()
rnf InstancePrivateIpAddress' {Maybe Bool
Maybe Text
Maybe InstanceNetworkInterfaceAssociation
privateIpAddress :: Maybe Text
privateDnsName :: Maybe Text
primary :: Maybe Bool
association :: Maybe InstanceNetworkInterfaceAssociation
$sel:privateIpAddress:InstancePrivateIpAddress' :: InstancePrivateIpAddress -> Maybe Text
$sel:privateDnsName:InstancePrivateIpAddress' :: InstancePrivateIpAddress -> Maybe Text
$sel:primary:InstancePrivateIpAddress' :: InstancePrivateIpAddress -> Maybe Bool
$sel:association:InstancePrivateIpAddress' :: InstancePrivateIpAddress
-> Maybe InstanceNetworkInterfaceAssociation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceNetworkInterfaceAssociation
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