{-# 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 #-}
module Amazonka.SecurityHub.Types.ActionRemotePortDetails where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ActionRemotePortDetails = ActionRemotePortDetails'
{
ActionRemotePortDetails -> Maybe Text
portName :: Prelude.Maybe Prelude.Text,
ActionRemotePortDetails -> Maybe Int
port :: Prelude.Maybe Prelude.Int
}
deriving (ActionRemotePortDetails -> ActionRemotePortDetails -> Bool
(ActionRemotePortDetails -> ActionRemotePortDetails -> Bool)
-> (ActionRemotePortDetails -> ActionRemotePortDetails -> Bool)
-> Eq ActionRemotePortDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionRemotePortDetails -> ActionRemotePortDetails -> Bool
$c/= :: ActionRemotePortDetails -> ActionRemotePortDetails -> Bool
== :: ActionRemotePortDetails -> ActionRemotePortDetails -> Bool
$c== :: ActionRemotePortDetails -> ActionRemotePortDetails -> Bool
Prelude.Eq, ReadPrec [ActionRemotePortDetails]
ReadPrec ActionRemotePortDetails
Int -> ReadS ActionRemotePortDetails
ReadS [ActionRemotePortDetails]
(Int -> ReadS ActionRemotePortDetails)
-> ReadS [ActionRemotePortDetails]
-> ReadPrec ActionRemotePortDetails
-> ReadPrec [ActionRemotePortDetails]
-> Read ActionRemotePortDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionRemotePortDetails]
$creadListPrec :: ReadPrec [ActionRemotePortDetails]
readPrec :: ReadPrec ActionRemotePortDetails
$creadPrec :: ReadPrec ActionRemotePortDetails
readList :: ReadS [ActionRemotePortDetails]
$creadList :: ReadS [ActionRemotePortDetails]
readsPrec :: Int -> ReadS ActionRemotePortDetails
$creadsPrec :: Int -> ReadS ActionRemotePortDetails
Prelude.Read, Int -> ActionRemotePortDetails -> ShowS
[ActionRemotePortDetails] -> ShowS
ActionRemotePortDetails -> String
(Int -> ActionRemotePortDetails -> ShowS)
-> (ActionRemotePortDetails -> String)
-> ([ActionRemotePortDetails] -> ShowS)
-> Show ActionRemotePortDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionRemotePortDetails] -> ShowS
$cshowList :: [ActionRemotePortDetails] -> ShowS
show :: ActionRemotePortDetails -> String
$cshow :: ActionRemotePortDetails -> String
showsPrec :: Int -> ActionRemotePortDetails -> ShowS
$cshowsPrec :: Int -> ActionRemotePortDetails -> ShowS
Prelude.Show, (forall x.
ActionRemotePortDetails -> Rep ActionRemotePortDetails x)
-> (forall x.
Rep ActionRemotePortDetails x -> ActionRemotePortDetails)
-> Generic ActionRemotePortDetails
forall x. Rep ActionRemotePortDetails x -> ActionRemotePortDetails
forall x. ActionRemotePortDetails -> Rep ActionRemotePortDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionRemotePortDetails x -> ActionRemotePortDetails
$cfrom :: forall x. ActionRemotePortDetails -> Rep ActionRemotePortDetails x
Prelude.Generic)
newActionRemotePortDetails ::
ActionRemotePortDetails
newActionRemotePortDetails :: ActionRemotePortDetails
newActionRemotePortDetails =
ActionRemotePortDetails' :: Maybe Text -> Maybe Int -> ActionRemotePortDetails
ActionRemotePortDetails'
{ $sel:portName:ActionRemotePortDetails' :: Maybe Text
portName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:port:ActionRemotePortDetails' :: Maybe Int
port = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
actionRemotePortDetails_portName :: Lens.Lens' ActionRemotePortDetails (Prelude.Maybe Prelude.Text)
actionRemotePortDetails_portName :: (Maybe Text -> f (Maybe Text))
-> ActionRemotePortDetails -> f ActionRemotePortDetails
actionRemotePortDetails_portName = (ActionRemotePortDetails -> Maybe Text)
-> (ActionRemotePortDetails
-> Maybe Text -> ActionRemotePortDetails)
-> Lens
ActionRemotePortDetails
ActionRemotePortDetails
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionRemotePortDetails' {Maybe Text
portName :: Maybe Text
$sel:portName:ActionRemotePortDetails' :: ActionRemotePortDetails -> Maybe Text
portName} -> Maybe Text
portName) (\s :: ActionRemotePortDetails
s@ActionRemotePortDetails' {} Maybe Text
a -> ActionRemotePortDetails
s {$sel:portName:ActionRemotePortDetails' :: Maybe Text
portName = Maybe Text
a} :: ActionRemotePortDetails)
actionRemotePortDetails_port :: Lens.Lens' ActionRemotePortDetails (Prelude.Maybe Prelude.Int)
actionRemotePortDetails_port :: (Maybe Int -> f (Maybe Int))
-> ActionRemotePortDetails -> f ActionRemotePortDetails
actionRemotePortDetails_port = (ActionRemotePortDetails -> Maybe Int)
-> (ActionRemotePortDetails
-> Maybe Int -> ActionRemotePortDetails)
-> Lens
ActionRemotePortDetails
ActionRemotePortDetails
(Maybe Int)
(Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionRemotePortDetails' {Maybe Int
port :: Maybe Int
$sel:port:ActionRemotePortDetails' :: ActionRemotePortDetails -> Maybe Int
port} -> Maybe Int
port) (\s :: ActionRemotePortDetails
s@ActionRemotePortDetails' {} Maybe Int
a -> ActionRemotePortDetails
s {$sel:port:ActionRemotePortDetails' :: Maybe Int
port = Maybe Int
a} :: ActionRemotePortDetails)
instance Core.FromJSON ActionRemotePortDetails where
parseJSON :: Value -> Parser ActionRemotePortDetails
parseJSON =
String
-> (Object -> Parser ActionRemotePortDetails)
-> Value
-> Parser ActionRemotePortDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ActionRemotePortDetails"
( \Object
x ->
Maybe Text -> Maybe Int -> ActionRemotePortDetails
ActionRemotePortDetails'
(Maybe Text -> Maybe Int -> ActionRemotePortDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> ActionRemotePortDetails)
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
"PortName")
Parser (Maybe Int -> ActionRemotePortDetails)
-> Parser (Maybe Int) -> Parser ActionRemotePortDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Port")
)
instance Prelude.Hashable ActionRemotePortDetails
instance Prelude.NFData ActionRemotePortDetails
instance Core.ToJSON ActionRemotePortDetails where
toJSON :: ActionRemotePortDetails -> Value
toJSON ActionRemotePortDetails' {Maybe Int
Maybe Text
port :: Maybe Int
portName :: Maybe Text
$sel:port:ActionRemotePortDetails' :: ActionRemotePortDetails -> Maybe Int
$sel:portName:ActionRemotePortDetails' :: ActionRemotePortDetails -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PortName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
portName,
(Text
"Port" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
port
]
)