{-# 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.Inspector.Types.PrivateIp
-- 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.Inspector.Types.PrivateIp where

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

-- | Contains information about a private IP address associated with a
-- network interface. This data type is used as a response element in the
-- DescribeFindings action.
--
-- /See:/ 'newPrivateIp' smart constructor.
data PrivateIp = PrivateIp'
  { -- | The DNS name of the private IP address.
    PrivateIp -> Maybe Text
privateDnsName :: Prelude.Maybe Prelude.Text,
    -- | The full IP address of the network inteface.
    PrivateIp -> Maybe Text
privateIpAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (PrivateIp -> PrivateIp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrivateIp -> PrivateIp -> Bool
$c/= :: PrivateIp -> PrivateIp -> Bool
== :: PrivateIp -> PrivateIp -> Bool
$c== :: PrivateIp -> PrivateIp -> Bool
Prelude.Eq, ReadPrec [PrivateIp]
ReadPrec PrivateIp
Int -> ReadS PrivateIp
ReadS [PrivateIp]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrivateIp]
$creadListPrec :: ReadPrec [PrivateIp]
readPrec :: ReadPrec PrivateIp
$creadPrec :: ReadPrec PrivateIp
readList :: ReadS [PrivateIp]
$creadList :: ReadS [PrivateIp]
readsPrec :: Int -> ReadS PrivateIp
$creadsPrec :: Int -> ReadS PrivateIp
Prelude.Read, Int -> PrivateIp -> ShowS
[PrivateIp] -> ShowS
PrivateIp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrivateIp] -> ShowS
$cshowList :: [PrivateIp] -> ShowS
show :: PrivateIp -> String
$cshow :: PrivateIp -> String
showsPrec :: Int -> PrivateIp -> ShowS
$cshowsPrec :: Int -> PrivateIp -> ShowS
Prelude.Show, forall x. Rep PrivateIp x -> PrivateIp
forall x. PrivateIp -> Rep PrivateIp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrivateIp x -> PrivateIp
$cfrom :: forall x. PrivateIp -> Rep PrivateIp x
Prelude.Generic)

-- |
-- Create a value of 'PrivateIp' 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:
--
-- 'privateDnsName', 'privateIp_privateDnsName' - The DNS name of the private IP address.
--
-- 'privateIpAddress', 'privateIp_privateIpAddress' - The full IP address of the network inteface.
newPrivateIp ::
  PrivateIp
newPrivateIp :: PrivateIp
newPrivateIp =
  PrivateIp'
    { $sel:privateDnsName:PrivateIp' :: Maybe Text
privateDnsName = forall a. Maybe a
Prelude.Nothing,
      $sel:privateIpAddress:PrivateIp' :: Maybe Text
privateIpAddress = forall a. Maybe a
Prelude.Nothing
    }

-- | The DNS name of the private IP address.
privateIp_privateDnsName :: Lens.Lens' PrivateIp (Prelude.Maybe Prelude.Text)
privateIp_privateDnsName :: Lens' PrivateIp (Maybe Text)
privateIp_privateDnsName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateIp' {Maybe Text
privateDnsName :: Maybe Text
$sel:privateDnsName:PrivateIp' :: PrivateIp -> Maybe Text
privateDnsName} -> Maybe Text
privateDnsName) (\s :: PrivateIp
s@PrivateIp' {} Maybe Text
a -> PrivateIp
s {$sel:privateDnsName:PrivateIp' :: Maybe Text
privateDnsName = Maybe Text
a} :: PrivateIp)

-- | The full IP address of the network inteface.
privateIp_privateIpAddress :: Lens.Lens' PrivateIp (Prelude.Maybe Prelude.Text)
privateIp_privateIpAddress :: Lens' PrivateIp (Maybe Text)
privateIp_privateIpAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateIp' {Maybe Text
privateIpAddress :: Maybe Text
$sel:privateIpAddress:PrivateIp' :: PrivateIp -> Maybe Text
privateIpAddress} -> Maybe Text
privateIpAddress) (\s :: PrivateIp
s@PrivateIp' {} Maybe Text
a -> PrivateIp
s {$sel:privateIpAddress:PrivateIp' :: Maybe Text
privateIpAddress = Maybe Text
a} :: PrivateIp)

instance Data.FromJSON PrivateIp where
  parseJSON :: Value -> Parser PrivateIp
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PrivateIp"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> PrivateIp
PrivateIp'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"privateDnsName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"privateIpAddress")
      )

instance Prelude.Hashable PrivateIp where
  hashWithSalt :: Int -> PrivateIp -> Int
hashWithSalt Int
_salt PrivateIp' {Maybe Text
privateIpAddress :: Maybe Text
privateDnsName :: Maybe Text
$sel:privateIpAddress:PrivateIp' :: PrivateIp -> Maybe Text
$sel:privateDnsName:PrivateIp' :: PrivateIp -> Maybe Text
..} =
    Int
_salt
      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 PrivateIp where
  rnf :: PrivateIp -> ()
rnf PrivateIp' {Maybe Text
privateIpAddress :: Maybe Text
privateDnsName :: Maybe Text
$sel:privateIpAddress:PrivateIp' :: PrivateIp -> Maybe Text
$sel:privateDnsName:PrivateIp' :: PrivateIp -> Maybe Text
..} =
    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