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

-- |
-- Create a value of 'RemotePortDetails' 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:
--
-- 'port', 'remotePortDetails_port' - The port number of the remote connection.
--
-- 'portName', 'remotePortDetails_portName' - The port name of the remote connection.
newRemotePortDetails ::
  RemotePortDetails
newRemotePortDetails :: RemotePortDetails
newRemotePortDetails =
  RemotePortDetails'
    { $sel:port:RemotePortDetails' :: Maybe Int
port = forall a. Maybe a
Prelude.Nothing,
      $sel:portName:RemotePortDetails' :: Maybe Text
portName = forall a. Maybe a
Prelude.Nothing
    }

-- | The port number of the remote connection.
remotePortDetails_port :: Lens.Lens' RemotePortDetails (Prelude.Maybe Prelude.Int)
remotePortDetails_port :: Lens' RemotePortDetails (Maybe Int)
remotePortDetails_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemotePortDetails' {Maybe Int
port :: Maybe Int
$sel:port:RemotePortDetails' :: RemotePortDetails -> Maybe Int
port} -> Maybe Int
port) (\s :: RemotePortDetails
s@RemotePortDetails' {} Maybe Int
a -> RemotePortDetails
s {$sel:port:RemotePortDetails' :: Maybe Int
port = Maybe Int
a} :: RemotePortDetails)

-- | The port name of the remote connection.
remotePortDetails_portName :: Lens.Lens' RemotePortDetails (Prelude.Maybe Prelude.Text)
remotePortDetails_portName :: Lens' RemotePortDetails (Maybe Text)
remotePortDetails_portName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemotePortDetails' {Maybe Text
portName :: Maybe Text
$sel:portName:RemotePortDetails' :: RemotePortDetails -> Maybe Text
portName} -> Maybe Text
portName) (\s :: RemotePortDetails
s@RemotePortDetails' {} Maybe Text
a -> RemotePortDetails
s {$sel:portName:RemotePortDetails' :: Maybe Text
portName = Maybe Text
a} :: RemotePortDetails)

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

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

instance Prelude.NFData RemotePortDetails where
  rnf :: RemotePortDetails -> ()
rnf RemotePortDetails' {Maybe Int
Maybe Text
portName :: Maybe Text
port :: Maybe Int
$sel:portName:RemotePortDetails' :: RemotePortDetails -> Maybe Text
$sel:port:RemotePortDetails' :: RemotePortDetails -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
port seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
portName