{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector.Types.PrivateIp where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 full IP address of the network inteface.
    PrivateIp -> Maybe Text
privateIpAddress :: Prelude.Maybe Prelude.Text,
    -- | The DNS name of the private IP address.
    PrivateIp -> Maybe Text
privateDnsName :: Prelude.Maybe Prelude.Text
  }
  deriving (PrivateIp -> PrivateIp -> Bool
(PrivateIp -> PrivateIp -> Bool)
-> (PrivateIp -> PrivateIp -> Bool) -> Eq PrivateIp
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]
(Int -> ReadS PrivateIp)
-> ReadS [PrivateIp]
-> ReadPrec PrivateIp
-> ReadPrec [PrivateIp]
-> Read 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
(Int -> PrivateIp -> ShowS)
-> (PrivateIp -> String)
-> ([PrivateIp] -> ShowS)
-> Show PrivateIp
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. PrivateIp -> Rep PrivateIp x)
-> (forall x. Rep PrivateIp x -> PrivateIp) -> Generic PrivateIp
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:
--
-- 'privateIpAddress', 'privateIp_privateIpAddress' - The full IP address of the network inteface.
--
-- 'privateDnsName', 'privateIp_privateDnsName' - The DNS name of the private IP address.
newPrivateIp ::
  PrivateIp
newPrivateIp :: PrivateIp
newPrivateIp =
  PrivateIp' :: Maybe Text -> Maybe Text -> PrivateIp
PrivateIp'
    { $sel:privateIpAddress:PrivateIp' :: Maybe Text
privateIpAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:privateDnsName:PrivateIp' :: Maybe Text
privateDnsName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The full IP address of the network inteface.
privateIp_privateIpAddress :: Lens.Lens' PrivateIp (Prelude.Maybe Prelude.Text)
privateIp_privateIpAddress :: (Maybe Text -> f (Maybe Text)) -> PrivateIp -> f PrivateIp
privateIp_privateIpAddress = (PrivateIp -> Maybe Text)
-> (PrivateIp -> Maybe Text -> PrivateIp)
-> Lens PrivateIp PrivateIp (Maybe Text) (Maybe Text)
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)

-- | The DNS name of the private IP address.
privateIp_privateDnsName :: Lens.Lens' PrivateIp (Prelude.Maybe Prelude.Text)
privateIp_privateDnsName :: (Maybe Text -> f (Maybe Text)) -> PrivateIp -> f PrivateIp
privateIp_privateDnsName = (PrivateIp -> Maybe Text)
-> (PrivateIp -> Maybe Text -> PrivateIp)
-> Lens PrivateIp PrivateIp (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable PrivateIp

instance Prelude.NFData PrivateIp