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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types.LocalIpDetails
import Amazonka.GuardDuty.Types.LocalPortDetails
import Amazonka.GuardDuty.Types.RemoteIpDetails
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the port probe details.
--
-- /See:/ 'newPortProbeDetail' smart constructor.
data PortProbeDetail = PortProbeDetail'
  { -- | The local IP information of the connection.
    PortProbeDetail -> Maybe LocalIpDetails
localIpDetails :: Prelude.Maybe LocalIpDetails,
    -- | The local port information of the connection.
    PortProbeDetail -> Maybe LocalPortDetails
localPortDetails :: Prelude.Maybe LocalPortDetails,
    -- | The remote IP information of the connection.
    PortProbeDetail -> Maybe RemoteIpDetails
remoteIpDetails :: Prelude.Maybe RemoteIpDetails
  }
  deriving (PortProbeDetail -> PortProbeDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PortProbeDetail -> PortProbeDetail -> Bool
$c/= :: PortProbeDetail -> PortProbeDetail -> Bool
== :: PortProbeDetail -> PortProbeDetail -> Bool
$c== :: PortProbeDetail -> PortProbeDetail -> Bool
Prelude.Eq, ReadPrec [PortProbeDetail]
ReadPrec PortProbeDetail
Int -> ReadS PortProbeDetail
ReadS [PortProbeDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PortProbeDetail]
$creadListPrec :: ReadPrec [PortProbeDetail]
readPrec :: ReadPrec PortProbeDetail
$creadPrec :: ReadPrec PortProbeDetail
readList :: ReadS [PortProbeDetail]
$creadList :: ReadS [PortProbeDetail]
readsPrec :: Int -> ReadS PortProbeDetail
$creadsPrec :: Int -> ReadS PortProbeDetail
Prelude.Read, Int -> PortProbeDetail -> ShowS
[PortProbeDetail] -> ShowS
PortProbeDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortProbeDetail] -> ShowS
$cshowList :: [PortProbeDetail] -> ShowS
show :: PortProbeDetail -> String
$cshow :: PortProbeDetail -> String
showsPrec :: Int -> PortProbeDetail -> ShowS
$cshowsPrec :: Int -> PortProbeDetail -> ShowS
Prelude.Show, forall x. Rep PortProbeDetail x -> PortProbeDetail
forall x. PortProbeDetail -> Rep PortProbeDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PortProbeDetail x -> PortProbeDetail
$cfrom :: forall x. PortProbeDetail -> Rep PortProbeDetail x
Prelude.Generic)

-- |
-- Create a value of 'PortProbeDetail' 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:
--
-- 'localIpDetails', 'portProbeDetail_localIpDetails' - The local IP information of the connection.
--
-- 'localPortDetails', 'portProbeDetail_localPortDetails' - The local port information of the connection.
--
-- 'remoteIpDetails', 'portProbeDetail_remoteIpDetails' - The remote IP information of the connection.
newPortProbeDetail ::
  PortProbeDetail
newPortProbeDetail :: PortProbeDetail
newPortProbeDetail =
  PortProbeDetail'
    { $sel:localIpDetails:PortProbeDetail' :: Maybe LocalIpDetails
localIpDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:localPortDetails:PortProbeDetail' :: Maybe LocalPortDetails
localPortDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:remoteIpDetails:PortProbeDetail' :: Maybe RemoteIpDetails
remoteIpDetails = forall a. Maybe a
Prelude.Nothing
    }

-- | The local IP information of the connection.
portProbeDetail_localIpDetails :: Lens.Lens' PortProbeDetail (Prelude.Maybe LocalIpDetails)
portProbeDetail_localIpDetails :: Lens' PortProbeDetail (Maybe LocalIpDetails)
portProbeDetail_localIpDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortProbeDetail' {Maybe LocalIpDetails
localIpDetails :: Maybe LocalIpDetails
$sel:localIpDetails:PortProbeDetail' :: PortProbeDetail -> Maybe LocalIpDetails
localIpDetails} -> Maybe LocalIpDetails
localIpDetails) (\s :: PortProbeDetail
s@PortProbeDetail' {} Maybe LocalIpDetails
a -> PortProbeDetail
s {$sel:localIpDetails:PortProbeDetail' :: Maybe LocalIpDetails
localIpDetails = Maybe LocalIpDetails
a} :: PortProbeDetail)

-- | The local port information of the connection.
portProbeDetail_localPortDetails :: Lens.Lens' PortProbeDetail (Prelude.Maybe LocalPortDetails)
portProbeDetail_localPortDetails :: Lens' PortProbeDetail (Maybe LocalPortDetails)
portProbeDetail_localPortDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortProbeDetail' {Maybe LocalPortDetails
localPortDetails :: Maybe LocalPortDetails
$sel:localPortDetails:PortProbeDetail' :: PortProbeDetail -> Maybe LocalPortDetails
localPortDetails} -> Maybe LocalPortDetails
localPortDetails) (\s :: PortProbeDetail
s@PortProbeDetail' {} Maybe LocalPortDetails
a -> PortProbeDetail
s {$sel:localPortDetails:PortProbeDetail' :: Maybe LocalPortDetails
localPortDetails = Maybe LocalPortDetails
a} :: PortProbeDetail)

-- | The remote IP information of the connection.
portProbeDetail_remoteIpDetails :: Lens.Lens' PortProbeDetail (Prelude.Maybe RemoteIpDetails)
portProbeDetail_remoteIpDetails :: Lens' PortProbeDetail (Maybe RemoteIpDetails)
portProbeDetail_remoteIpDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortProbeDetail' {Maybe RemoteIpDetails
remoteIpDetails :: Maybe RemoteIpDetails
$sel:remoteIpDetails:PortProbeDetail' :: PortProbeDetail -> Maybe RemoteIpDetails
remoteIpDetails} -> Maybe RemoteIpDetails
remoteIpDetails) (\s :: PortProbeDetail
s@PortProbeDetail' {} Maybe RemoteIpDetails
a -> PortProbeDetail
s {$sel:remoteIpDetails:PortProbeDetail' :: Maybe RemoteIpDetails
remoteIpDetails = Maybe RemoteIpDetails
a} :: PortProbeDetail)

instance Data.FromJSON PortProbeDetail where
  parseJSON :: Value -> Parser PortProbeDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PortProbeDetail"
      ( \Object
x ->
          Maybe LocalIpDetails
-> Maybe LocalPortDetails
-> Maybe RemoteIpDetails
-> PortProbeDetail
PortProbeDetail'
            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
"localIpDetails")
            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
"localPortDetails")
            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
"remoteIpDetails")
      )

instance Prelude.Hashable PortProbeDetail where
  hashWithSalt :: Int -> PortProbeDetail -> Int
hashWithSalt Int
_salt PortProbeDetail' {Maybe LocalIpDetails
Maybe LocalPortDetails
Maybe RemoteIpDetails
remoteIpDetails :: Maybe RemoteIpDetails
localPortDetails :: Maybe LocalPortDetails
localIpDetails :: Maybe LocalIpDetails
$sel:remoteIpDetails:PortProbeDetail' :: PortProbeDetail -> Maybe RemoteIpDetails
$sel:localPortDetails:PortProbeDetail' :: PortProbeDetail -> Maybe LocalPortDetails
$sel:localIpDetails:PortProbeDetail' :: PortProbeDetail -> Maybe LocalIpDetails
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LocalIpDetails
localIpDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LocalPortDetails
localPortDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RemoteIpDetails
remoteIpDetails

instance Prelude.NFData PortProbeDetail where
  rnf :: PortProbeDetail -> ()
rnf PortProbeDetail' {Maybe LocalIpDetails
Maybe LocalPortDetails
Maybe RemoteIpDetails
remoteIpDetails :: Maybe RemoteIpDetails
localPortDetails :: Maybe LocalPortDetails
localIpDetails :: Maybe LocalIpDetails
$sel:remoteIpDetails:PortProbeDetail' :: PortProbeDetail -> Maybe RemoteIpDetails
$sel:localPortDetails:PortProbeDetail' :: PortProbeDetail -> Maybe LocalPortDetails
$sel:localIpDetails:PortProbeDetail' :: PortProbeDetail -> Maybe LocalIpDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LocalIpDetails
localIpDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LocalPortDetails
localPortDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RemoteIpDetails
remoteIpDetails