{-# 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-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.LocalIpDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(LocalIpDetails -> LocalIpDetails -> Bool)
-> (LocalIpDetails -> LocalIpDetails -> Bool) -> Eq LocalIpDetails
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]
(Int -> ReadS LocalIpDetails)
-> ReadS [LocalIpDetails]
-> ReadPrec LocalIpDetails
-> ReadPrec [LocalIpDetails]
-> Read 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
(Int -> LocalIpDetails -> ShowS)
-> (LocalIpDetails -> String)
-> ([LocalIpDetails] -> ShowS)
-> Show LocalIpDetails
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. LocalIpDetails -> Rep LocalIpDetails x)
-> (forall x. Rep LocalIpDetails x -> LocalIpDetails)
-> Generic LocalIpDetails
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' :: Maybe Text -> LocalIpDetails
LocalIpDetails' {$sel:ipAddressV4:LocalIpDetails' :: Maybe Text
ipAddressV4 = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The IPv4 local address of the connection.
localIpDetails_ipAddressV4 :: Lens.Lens' LocalIpDetails (Prelude.Maybe Prelude.Text)
localIpDetails_ipAddressV4 :: (Maybe Text -> f (Maybe Text))
-> LocalIpDetails -> f LocalIpDetails
localIpDetails_ipAddressV4 = (LocalIpDetails -> Maybe Text)
-> (LocalIpDetails -> Maybe Text -> LocalIpDetails)
-> Lens LocalIpDetails LocalIpDetails (Maybe Text) (Maybe Text)
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 Core.FromJSON LocalIpDetails where
  parseJSON :: Value -> Parser LocalIpDetails
parseJSON =
    String
-> (Object -> Parser LocalIpDetails)
-> Value
-> Parser LocalIpDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LocalIpDetails"
      ( \Object
x ->
          Maybe Text -> LocalIpDetails
LocalIpDetails'
            (Maybe Text -> LocalIpDetails)
-> Parser (Maybe Text) -> Parser LocalIpDetails
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
"ipAddressV4")
      )

instance Prelude.Hashable LocalIpDetails

instance Prelude.NFData LocalIpDetails