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

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

-- | Contains information about the port probe details.
--
-- /See:/ 'newPortProbeDetail' smart constructor.
data PortProbeDetail = PortProbeDetail'
  { -- | The remote IP information of the connection.
    PortProbeDetail -> Maybe RemoteIpDetails
remoteIpDetails :: Prelude.Maybe RemoteIpDetails,
    -- | 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
  }
  deriving (PortProbeDetail -> PortProbeDetail -> Bool
(PortProbeDetail -> PortProbeDetail -> Bool)
-> (PortProbeDetail -> PortProbeDetail -> Bool)
-> Eq PortProbeDetail
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]
(Int -> ReadS PortProbeDetail)
-> ReadS [PortProbeDetail]
-> ReadPrec PortProbeDetail
-> ReadPrec [PortProbeDetail]
-> Read 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
(Int -> PortProbeDetail -> ShowS)
-> (PortProbeDetail -> String)
-> ([PortProbeDetail] -> ShowS)
-> Show PortProbeDetail
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. PortProbeDetail -> Rep PortProbeDetail x)
-> (forall x. Rep PortProbeDetail x -> PortProbeDetail)
-> Generic PortProbeDetail
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:
--
-- 'remoteIpDetails', 'portProbeDetail_remoteIpDetails' - The remote IP information of the connection.
--
-- 'localIpDetails', 'portProbeDetail_localIpDetails' - The local IP information of the connection.
--
-- 'localPortDetails', 'portProbeDetail_localPortDetails' - The local port information of the connection.
newPortProbeDetail ::
  PortProbeDetail
newPortProbeDetail :: PortProbeDetail
newPortProbeDetail =
  PortProbeDetail' :: Maybe RemoteIpDetails
-> Maybe LocalIpDetails
-> Maybe LocalPortDetails
-> PortProbeDetail
PortProbeDetail'
    { $sel:remoteIpDetails:PortProbeDetail' :: Maybe RemoteIpDetails
remoteIpDetails = Maybe RemoteIpDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:localIpDetails:PortProbeDetail' :: Maybe LocalIpDetails
localIpDetails = Maybe LocalIpDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:localPortDetails:PortProbeDetail' :: Maybe LocalPortDetails
localPortDetails = Maybe LocalPortDetails
forall a. Maybe a
Prelude.Nothing
    }

-- | The remote IP information of the connection.
portProbeDetail_remoteIpDetails :: Lens.Lens' PortProbeDetail (Prelude.Maybe RemoteIpDetails)
portProbeDetail_remoteIpDetails :: (Maybe RemoteIpDetails -> f (Maybe RemoteIpDetails))
-> PortProbeDetail -> f PortProbeDetail
portProbeDetail_remoteIpDetails = (PortProbeDetail -> Maybe RemoteIpDetails)
-> (PortProbeDetail -> Maybe RemoteIpDetails -> PortProbeDetail)
-> Lens
     PortProbeDetail
     PortProbeDetail
     (Maybe RemoteIpDetails)
     (Maybe 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)

-- | The local IP information of the connection.
portProbeDetail_localIpDetails :: Lens.Lens' PortProbeDetail (Prelude.Maybe LocalIpDetails)
portProbeDetail_localIpDetails :: (Maybe LocalIpDetails -> f (Maybe LocalIpDetails))
-> PortProbeDetail -> f PortProbeDetail
portProbeDetail_localIpDetails = (PortProbeDetail -> Maybe LocalIpDetails)
-> (PortProbeDetail -> Maybe LocalIpDetails -> PortProbeDetail)
-> Lens
     PortProbeDetail
     PortProbeDetail
     (Maybe LocalIpDetails)
     (Maybe 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 :: (Maybe LocalPortDetails -> f (Maybe LocalPortDetails))
-> PortProbeDetail -> f PortProbeDetail
portProbeDetail_localPortDetails = (PortProbeDetail -> Maybe LocalPortDetails)
-> (PortProbeDetail -> Maybe LocalPortDetails -> PortProbeDetail)
-> Lens
     PortProbeDetail
     PortProbeDetail
     (Maybe LocalPortDetails)
     (Maybe 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)

instance Core.FromJSON PortProbeDetail where
  parseJSON :: Value -> Parser PortProbeDetail
parseJSON =
    String
-> (Object -> Parser PortProbeDetail)
-> Value
-> Parser PortProbeDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PortProbeDetail"
      ( \Object
x ->
          Maybe RemoteIpDetails
-> Maybe LocalIpDetails
-> Maybe LocalPortDetails
-> PortProbeDetail
PortProbeDetail'
            (Maybe RemoteIpDetails
 -> Maybe LocalIpDetails
 -> Maybe LocalPortDetails
 -> PortProbeDetail)
-> Parser (Maybe RemoteIpDetails)
-> Parser
     (Maybe LocalIpDetails -> Maybe LocalPortDetails -> PortProbeDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RemoteIpDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"remoteIpDetails")
            Parser
  (Maybe LocalIpDetails -> Maybe LocalPortDetails -> PortProbeDetail)
-> Parser (Maybe LocalIpDetails)
-> Parser (Maybe LocalPortDetails -> PortProbeDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LocalIpDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"localIpDetails")
            Parser (Maybe LocalPortDetails -> PortProbeDetail)
-> Parser (Maybe LocalPortDetails) -> Parser PortProbeDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LocalPortDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"localPortDetails")
      )

instance Prelude.Hashable PortProbeDetail

instance Prelude.NFData PortProbeDetail