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