{-# 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.LocalIpDetails
-- 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.GuardDuty.Types.LocalIpDetails 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 the local IP address of the connection.
--
-- /See:/ 'newLocalIpDetails' smart constructor.
data LocalIpDetails = LocalIpDetails'
  { -- | The IPv4 local address of the connection.
    LocalIpDetails -> Maybe Text
ipAddressV4 :: Prelude.Maybe Prelude.Text
  }
  deriving (LocalIpDetails -> LocalIpDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LocalIpDetails -> LocalIpDetails -> Bool
$c/= :: LocalIpDetails -> LocalIpDetails -> Bool
== :: LocalIpDetails -> LocalIpDetails -> Bool
$c== :: LocalIpDetails -> LocalIpDetails -> Bool
Prelude.Eq, ReadPrec [LocalIpDetails]
ReadPrec LocalIpDetails
Int -> ReadS LocalIpDetails
ReadS [LocalIpDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LocalIpDetails]
$creadListPrec :: ReadPrec [LocalIpDetails]
readPrec :: ReadPrec LocalIpDetails
$creadPrec :: ReadPrec LocalIpDetails
readList :: ReadS [LocalIpDetails]
$creadList :: ReadS [LocalIpDetails]
readsPrec :: Int -> ReadS LocalIpDetails
$creadsPrec :: Int -> ReadS LocalIpDetails
Prelude.Read, Int -> LocalIpDetails -> ShowS
[LocalIpDetails] -> ShowS
LocalIpDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LocalIpDetails] -> ShowS
$cshowList :: [LocalIpDetails] -> ShowS
show :: LocalIpDetails -> String
$cshow :: LocalIpDetails -> String
showsPrec :: Int -> LocalIpDetails -> ShowS
$cshowsPrec :: Int -> LocalIpDetails -> ShowS
Prelude.Show, forall x. Rep LocalIpDetails x -> LocalIpDetails
forall x. LocalIpDetails -> Rep LocalIpDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LocalIpDetails x -> LocalIpDetails
$cfrom :: forall x. LocalIpDetails -> Rep LocalIpDetails x
Prelude.Generic)

-- |
-- Create a value of 'LocalIpDetails' 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:
--
-- 'ipAddressV4', 'localIpDetails_ipAddressV4' - The IPv4 local address of the connection.
newLocalIpDetails ::
  LocalIpDetails
newLocalIpDetails :: LocalIpDetails
newLocalIpDetails =
  LocalIpDetails' {$sel:ipAddressV4:LocalIpDetails' :: Maybe Text
ipAddressV4 = forall a. Maybe a
Prelude.Nothing}

-- | The IPv4 local address of the connection.
localIpDetails_ipAddressV4 :: Lens.Lens' LocalIpDetails (Prelude.Maybe Prelude.Text)
localIpDetails_ipAddressV4 :: Lens' LocalIpDetails (Maybe Text)
localIpDetails_ipAddressV4 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocalIpDetails' {Maybe Text
ipAddressV4 :: Maybe Text
$sel:ipAddressV4:LocalIpDetails' :: LocalIpDetails -> Maybe Text
ipAddressV4} -> Maybe Text
ipAddressV4) (\s :: LocalIpDetails
s@LocalIpDetails' {} Maybe Text
a -> LocalIpDetails
s {$sel:ipAddressV4:LocalIpDetails' :: Maybe Text
ipAddressV4 = Maybe Text
a} :: LocalIpDetails)

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

instance Prelude.Hashable LocalIpDetails where
  hashWithSalt :: Int -> LocalIpDetails -> Int
hashWithSalt Int
_salt LocalIpDetails' {Maybe Text
ipAddressV4 :: Maybe Text
$sel:ipAddressV4:LocalIpDetails' :: LocalIpDetails -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipAddressV4

instance Prelude.NFData LocalIpDetails where
  rnf :: LocalIpDetails -> ()
rnf LocalIpDetails' {Maybe Text
ipAddressV4 :: Maybe Text
$sel:ipAddressV4:LocalIpDetails' :: LocalIpDetails -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipAddressV4