{-# 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.GuardDuty.Types.PrivateIpAddressDetails
-- 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.GuardDuty.Types.PrivateIpAddressDetails where

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

-- | Contains other private IP address information of the EC2 instance.
--
-- /See:/ 'newPrivateIpAddressDetails' smart constructor.
data PrivateIpAddressDetails = PrivateIpAddressDetails'
  { -- | The private IP address of the EC2 instance.
    PrivateIpAddressDetails -> Maybe Text
privateIpAddress :: Prelude.Maybe Prelude.Text,
    -- | The private DNS name of the EC2 instance.
    PrivateIpAddressDetails -> Maybe Text
privateDnsName :: Prelude.Maybe Prelude.Text
  }
  deriving (PrivateIpAddressDetails -> PrivateIpAddressDetails -> Bool
(PrivateIpAddressDetails -> PrivateIpAddressDetails -> Bool)
-> (PrivateIpAddressDetails -> PrivateIpAddressDetails -> Bool)
-> Eq PrivateIpAddressDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrivateIpAddressDetails -> PrivateIpAddressDetails -> Bool
$c/= :: PrivateIpAddressDetails -> PrivateIpAddressDetails -> Bool
== :: PrivateIpAddressDetails -> PrivateIpAddressDetails -> Bool
$c== :: PrivateIpAddressDetails -> PrivateIpAddressDetails -> Bool
Prelude.Eq, ReadPrec [PrivateIpAddressDetails]
ReadPrec PrivateIpAddressDetails
Int -> ReadS PrivateIpAddressDetails
ReadS [PrivateIpAddressDetails]
(Int -> ReadS PrivateIpAddressDetails)
-> ReadS [PrivateIpAddressDetails]
-> ReadPrec PrivateIpAddressDetails
-> ReadPrec [PrivateIpAddressDetails]
-> Read PrivateIpAddressDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrivateIpAddressDetails]
$creadListPrec :: ReadPrec [PrivateIpAddressDetails]
readPrec :: ReadPrec PrivateIpAddressDetails
$creadPrec :: ReadPrec PrivateIpAddressDetails
readList :: ReadS [PrivateIpAddressDetails]
$creadList :: ReadS [PrivateIpAddressDetails]
readsPrec :: Int -> ReadS PrivateIpAddressDetails
$creadsPrec :: Int -> ReadS PrivateIpAddressDetails
Prelude.Read, Int -> PrivateIpAddressDetails -> ShowS
[PrivateIpAddressDetails] -> ShowS
PrivateIpAddressDetails -> String
(Int -> PrivateIpAddressDetails -> ShowS)
-> (PrivateIpAddressDetails -> String)
-> ([PrivateIpAddressDetails] -> ShowS)
-> Show PrivateIpAddressDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrivateIpAddressDetails] -> ShowS
$cshowList :: [PrivateIpAddressDetails] -> ShowS
show :: PrivateIpAddressDetails -> String
$cshow :: PrivateIpAddressDetails -> String
showsPrec :: Int -> PrivateIpAddressDetails -> ShowS
$cshowsPrec :: Int -> PrivateIpAddressDetails -> ShowS
Prelude.Show, (forall x.
 PrivateIpAddressDetails -> Rep PrivateIpAddressDetails x)
-> (forall x.
    Rep PrivateIpAddressDetails x -> PrivateIpAddressDetails)
-> Generic PrivateIpAddressDetails
forall x. Rep PrivateIpAddressDetails x -> PrivateIpAddressDetails
forall x. PrivateIpAddressDetails -> Rep PrivateIpAddressDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrivateIpAddressDetails x -> PrivateIpAddressDetails
$cfrom :: forall x. PrivateIpAddressDetails -> Rep PrivateIpAddressDetails x
Prelude.Generic)

-- |
-- Create a value of 'PrivateIpAddressDetails' 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', 'privateIpAddressDetails_privateIpAddress' - The private IP address of the EC2 instance.
--
-- 'privateDnsName', 'privateIpAddressDetails_privateDnsName' - The private DNS name of the EC2 instance.
newPrivateIpAddressDetails ::
  PrivateIpAddressDetails
newPrivateIpAddressDetails :: PrivateIpAddressDetails
newPrivateIpAddressDetails =
  PrivateIpAddressDetails' :: Maybe Text -> Maybe Text -> PrivateIpAddressDetails
PrivateIpAddressDetails'
    { $sel:privateIpAddress:PrivateIpAddressDetails' :: Maybe Text
privateIpAddress =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:privateDnsName:PrivateIpAddressDetails' :: Maybe Text
privateDnsName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The private IP address of the EC2 instance.
privateIpAddressDetails_privateIpAddress :: Lens.Lens' PrivateIpAddressDetails (Prelude.Maybe Prelude.Text)
privateIpAddressDetails_privateIpAddress :: (Maybe Text -> f (Maybe Text))
-> PrivateIpAddressDetails -> f PrivateIpAddressDetails
privateIpAddressDetails_privateIpAddress = (PrivateIpAddressDetails -> Maybe Text)
-> (PrivateIpAddressDetails
    -> Maybe Text -> PrivateIpAddressDetails)
-> Lens
     PrivateIpAddressDetails
     PrivateIpAddressDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateIpAddressDetails' {Maybe Text
privateIpAddress :: Maybe Text
$sel:privateIpAddress:PrivateIpAddressDetails' :: PrivateIpAddressDetails -> Maybe Text
privateIpAddress} -> Maybe Text
privateIpAddress) (\s :: PrivateIpAddressDetails
s@PrivateIpAddressDetails' {} Maybe Text
a -> PrivateIpAddressDetails
s {$sel:privateIpAddress:PrivateIpAddressDetails' :: Maybe Text
privateIpAddress = Maybe Text
a} :: PrivateIpAddressDetails)

-- | The private DNS name of the EC2 instance.
privateIpAddressDetails_privateDnsName :: Lens.Lens' PrivateIpAddressDetails (Prelude.Maybe Prelude.Text)
privateIpAddressDetails_privateDnsName :: (Maybe Text -> f (Maybe Text))
-> PrivateIpAddressDetails -> f PrivateIpAddressDetails
privateIpAddressDetails_privateDnsName = (PrivateIpAddressDetails -> Maybe Text)
-> (PrivateIpAddressDetails
    -> Maybe Text -> PrivateIpAddressDetails)
-> Lens
     PrivateIpAddressDetails
     PrivateIpAddressDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateIpAddressDetails' {Maybe Text
privateDnsName :: Maybe Text
$sel:privateDnsName:PrivateIpAddressDetails' :: PrivateIpAddressDetails -> Maybe Text
privateDnsName} -> Maybe Text
privateDnsName) (\s :: PrivateIpAddressDetails
s@PrivateIpAddressDetails' {} Maybe Text
a -> PrivateIpAddressDetails
s {$sel:privateDnsName:PrivateIpAddressDetails' :: Maybe Text
privateDnsName = Maybe Text
a} :: PrivateIpAddressDetails)

instance Core.FromJSON PrivateIpAddressDetails where
  parseJSON :: Value -> Parser PrivateIpAddressDetails
parseJSON =
    String
-> (Object -> Parser PrivateIpAddressDetails)
-> Value
-> Parser PrivateIpAddressDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PrivateIpAddressDetails"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> PrivateIpAddressDetails
PrivateIpAddressDetails'
            (Maybe Text -> Maybe Text -> PrivateIpAddressDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> PrivateIpAddressDetails)
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 -> PrivateIpAddressDetails)
-> Parser (Maybe Text) -> Parser PrivateIpAddressDetails
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 PrivateIpAddressDetails

instance Prelude.NFData PrivateIpAddressDetails