{-# 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.NetworkPathComponentDetails where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.PortRange
data NetworkPathComponentDetails = NetworkPathComponentDetails'
{
NetworkPathComponentDetails -> Maybe [PortRange]
portRanges :: Prelude.Maybe [PortRange],
NetworkPathComponentDetails -> Maybe [Text]
address :: Prelude.Maybe [Prelude.Text]
}
deriving (NetworkPathComponentDetails -> NetworkPathComponentDetails -> Bool
(NetworkPathComponentDetails
-> NetworkPathComponentDetails -> Bool)
-> (NetworkPathComponentDetails
-> NetworkPathComponentDetails -> Bool)
-> Eq NetworkPathComponentDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkPathComponentDetails -> NetworkPathComponentDetails -> Bool
$c/= :: NetworkPathComponentDetails -> NetworkPathComponentDetails -> Bool
== :: NetworkPathComponentDetails -> NetworkPathComponentDetails -> Bool
$c== :: NetworkPathComponentDetails -> NetworkPathComponentDetails -> Bool
Prelude.Eq, ReadPrec [NetworkPathComponentDetails]
ReadPrec NetworkPathComponentDetails
Int -> ReadS NetworkPathComponentDetails
ReadS [NetworkPathComponentDetails]
(Int -> ReadS NetworkPathComponentDetails)
-> ReadS [NetworkPathComponentDetails]
-> ReadPrec NetworkPathComponentDetails
-> ReadPrec [NetworkPathComponentDetails]
-> Read NetworkPathComponentDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkPathComponentDetails]
$creadListPrec :: ReadPrec [NetworkPathComponentDetails]
readPrec :: ReadPrec NetworkPathComponentDetails
$creadPrec :: ReadPrec NetworkPathComponentDetails
readList :: ReadS [NetworkPathComponentDetails]
$creadList :: ReadS [NetworkPathComponentDetails]
readsPrec :: Int -> ReadS NetworkPathComponentDetails
$creadsPrec :: Int -> ReadS NetworkPathComponentDetails
Prelude.Read, Int -> NetworkPathComponentDetails -> ShowS
[NetworkPathComponentDetails] -> ShowS
NetworkPathComponentDetails -> String
(Int -> NetworkPathComponentDetails -> ShowS)
-> (NetworkPathComponentDetails -> String)
-> ([NetworkPathComponentDetails] -> ShowS)
-> Show NetworkPathComponentDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkPathComponentDetails] -> ShowS
$cshowList :: [NetworkPathComponentDetails] -> ShowS
show :: NetworkPathComponentDetails -> String
$cshow :: NetworkPathComponentDetails -> String
showsPrec :: Int -> NetworkPathComponentDetails -> ShowS
$cshowsPrec :: Int -> NetworkPathComponentDetails -> ShowS
Prelude.Show, (forall x.
NetworkPathComponentDetails -> Rep NetworkPathComponentDetails x)
-> (forall x.
Rep NetworkPathComponentDetails x -> NetworkPathComponentDetails)
-> Generic NetworkPathComponentDetails
forall x.
Rep NetworkPathComponentDetails x -> NetworkPathComponentDetails
forall x.
NetworkPathComponentDetails -> Rep NetworkPathComponentDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkPathComponentDetails x -> NetworkPathComponentDetails
$cfrom :: forall x.
NetworkPathComponentDetails -> Rep NetworkPathComponentDetails x
Prelude.Generic)
newNetworkPathComponentDetails ::
NetworkPathComponentDetails
newNetworkPathComponentDetails :: NetworkPathComponentDetails
newNetworkPathComponentDetails =
NetworkPathComponentDetails' :: Maybe [PortRange] -> Maybe [Text] -> NetworkPathComponentDetails
NetworkPathComponentDetails'
{ $sel:portRanges:NetworkPathComponentDetails' :: Maybe [PortRange]
portRanges =
Maybe [PortRange]
forall a. Maybe a
Prelude.Nothing,
$sel:address:NetworkPathComponentDetails' :: Maybe [Text]
address = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
networkPathComponentDetails_portRanges :: Lens.Lens' NetworkPathComponentDetails (Prelude.Maybe [PortRange])
networkPathComponentDetails_portRanges :: (Maybe [PortRange] -> f (Maybe [PortRange]))
-> NetworkPathComponentDetails -> f NetworkPathComponentDetails
networkPathComponentDetails_portRanges = (NetworkPathComponentDetails -> Maybe [PortRange])
-> (NetworkPathComponentDetails
-> Maybe [PortRange] -> NetworkPathComponentDetails)
-> Lens
NetworkPathComponentDetails
NetworkPathComponentDetails
(Maybe [PortRange])
(Maybe [PortRange])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkPathComponentDetails' {Maybe [PortRange]
portRanges :: Maybe [PortRange]
$sel:portRanges:NetworkPathComponentDetails' :: NetworkPathComponentDetails -> Maybe [PortRange]
portRanges} -> Maybe [PortRange]
portRanges) (\s :: NetworkPathComponentDetails
s@NetworkPathComponentDetails' {} Maybe [PortRange]
a -> NetworkPathComponentDetails
s {$sel:portRanges:NetworkPathComponentDetails' :: Maybe [PortRange]
portRanges = Maybe [PortRange]
a} :: NetworkPathComponentDetails) ((Maybe [PortRange] -> f (Maybe [PortRange]))
-> NetworkPathComponentDetails -> f NetworkPathComponentDetails)
-> ((Maybe [PortRange] -> f (Maybe [PortRange]))
-> Maybe [PortRange] -> f (Maybe [PortRange]))
-> (Maybe [PortRange] -> f (Maybe [PortRange]))
-> NetworkPathComponentDetails
-> f NetworkPathComponentDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PortRange] [PortRange] [PortRange] [PortRange]
-> Iso
(Maybe [PortRange])
(Maybe [PortRange])
(Maybe [PortRange])
(Maybe [PortRange])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [PortRange] [PortRange] [PortRange] [PortRange]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
networkPathComponentDetails_address :: Lens.Lens' NetworkPathComponentDetails (Prelude.Maybe [Prelude.Text])
networkPathComponentDetails_address :: (Maybe [Text] -> f (Maybe [Text]))
-> NetworkPathComponentDetails -> f NetworkPathComponentDetails
networkPathComponentDetails_address = (NetworkPathComponentDetails -> Maybe [Text])
-> (NetworkPathComponentDetails
-> Maybe [Text] -> NetworkPathComponentDetails)
-> Lens
NetworkPathComponentDetails
NetworkPathComponentDetails
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkPathComponentDetails' {Maybe [Text]
address :: Maybe [Text]
$sel:address:NetworkPathComponentDetails' :: NetworkPathComponentDetails -> Maybe [Text]
address} -> Maybe [Text]
address) (\s :: NetworkPathComponentDetails
s@NetworkPathComponentDetails' {} Maybe [Text]
a -> NetworkPathComponentDetails
s {$sel:address:NetworkPathComponentDetails' :: Maybe [Text]
address = Maybe [Text]
a} :: NetworkPathComponentDetails) ((Maybe [Text] -> f (Maybe [Text]))
-> NetworkPathComponentDetails -> f NetworkPathComponentDetails)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> NetworkPathComponentDetails
-> f NetworkPathComponentDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON NetworkPathComponentDetails where
parseJSON :: Value -> Parser NetworkPathComponentDetails
parseJSON =
String
-> (Object -> Parser NetworkPathComponentDetails)
-> Value
-> Parser NetworkPathComponentDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"NetworkPathComponentDetails"
( \Object
x ->
Maybe [PortRange] -> Maybe [Text] -> NetworkPathComponentDetails
NetworkPathComponentDetails'
(Maybe [PortRange] -> Maybe [Text] -> NetworkPathComponentDetails)
-> Parser (Maybe [PortRange])
-> Parser (Maybe [Text] -> NetworkPathComponentDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [PortRange]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PortRanges" Parser (Maybe (Maybe [PortRange]))
-> Maybe [PortRange] -> Parser (Maybe [PortRange])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PortRange]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe [Text] -> NetworkPathComponentDetails)
-> Parser (Maybe [Text]) -> Parser NetworkPathComponentDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Address" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable NetworkPathComponentDetails
instance Prelude.NFData NetworkPathComponentDetails
instance Core.ToJSON NetworkPathComponentDetails where
toJSON :: NetworkPathComponentDetails -> Value
toJSON NetworkPathComponentDetails' {Maybe [Text]
Maybe [PortRange]
address :: Maybe [Text]
portRanges :: Maybe [PortRange]
$sel:address:NetworkPathComponentDetails' :: NetworkPathComponentDetails -> Maybe [Text]
$sel:portRanges:NetworkPathComponentDetails' :: NetworkPathComponentDetails -> Maybe [PortRange]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PortRanges" Text -> [PortRange] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([PortRange] -> Pair) -> Maybe [PortRange] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PortRange]
portRanges,
(Text
"Address" 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]
address
]
)