{-# 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.NetworkFirewall.Types.Header where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkFirewall.Types.StatefulRuleDirection
import Amazonka.NetworkFirewall.Types.StatefulRuleProtocol
import qualified Amazonka.Prelude as Prelude
data =
{
:: StatefulRuleProtocol,
:: Prelude.Text,
:: Prelude.Text,
:: StatefulRuleDirection,
:: Prelude.Text,
:: Prelude.Text
}
deriving (Header -> Header -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Header -> Header -> Bool
$c/= :: Header -> Header -> Bool
== :: Header -> Header -> Bool
$c== :: Header -> Header -> Bool
Prelude.Eq, ReadPrec [Header]
ReadPrec Header
Int -> ReadS Header
ReadS [Header]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Header]
$creadListPrec :: ReadPrec [Header]
readPrec :: ReadPrec Header
$creadPrec :: ReadPrec Header
readList :: ReadS [Header]
$creadList :: ReadS [Header]
readsPrec :: Int -> ReadS Header
$creadsPrec :: Int -> ReadS Header
Prelude.Read, Int -> Header -> ShowS
[Header] -> ShowS
Header -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Header] -> ShowS
$cshowList :: [Header] -> ShowS
show :: Header -> String
$cshow :: Header -> String
showsPrec :: Int -> Header -> ShowS
$cshowsPrec :: Int -> Header -> ShowS
Prelude.Show, forall x. Rep Header x -> Header
forall x. Header -> Rep Header x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Header x -> Header
$cfrom :: forall x. Header -> Rep Header x
Prelude.Generic)
newHeader ::
StatefulRuleProtocol ->
Prelude.Text ->
Prelude.Text ->
StatefulRuleDirection ->
Prelude.Text ->
Prelude.Text ->
Header
StatefulRuleProtocol
pProtocol_
Text
pSource_
Text
pSourcePort_
StatefulRuleDirection
pDirection_
Text
pDestination_
Text
pDestinationPort_ =
Header'
{ $sel:protocol:Header' :: StatefulRuleProtocol
protocol = StatefulRuleProtocol
pProtocol_,
$sel:source:Header' :: Text
source = Text
pSource_,
$sel:sourcePort:Header' :: Text
sourcePort = Text
pSourcePort_,
$sel:direction:Header' :: StatefulRuleDirection
direction = StatefulRuleDirection
pDirection_,
$sel:destination:Header' :: Text
destination = Text
pDestination_,
$sel:destinationPort:Header' :: Text
destinationPort = Text
pDestinationPort_
}
header_protocol :: Lens.Lens' Header StatefulRuleProtocol
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Header' {StatefulRuleProtocol
protocol :: StatefulRuleProtocol
$sel:protocol:Header' :: Header -> StatefulRuleProtocol
protocol} -> StatefulRuleProtocol
protocol) (\s :: Header
s@Header' {} StatefulRuleProtocol
a -> Header
s {$sel:protocol:Header' :: StatefulRuleProtocol
protocol = StatefulRuleProtocol
a} :: Header)
header_source :: Lens.Lens' Header Prelude.Text
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Header' {Text
source :: Text
$sel:source:Header' :: Header -> Text
source} -> Text
source) (\s :: Header
s@Header' {} Text
a -> Header
s {$sel:source:Header' :: Text
source = Text
a} :: Header)
header_sourcePort :: Lens.Lens' Header Prelude.Text
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Header' {Text
sourcePort :: Text
$sel:sourcePort:Header' :: Header -> Text
sourcePort} -> Text
sourcePort) (\s :: Header
s@Header' {} Text
a -> Header
s {$sel:sourcePort:Header' :: Text
sourcePort = Text
a} :: Header)
header_direction :: Lens.Lens' Header StatefulRuleDirection
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Header' {StatefulRuleDirection
direction :: StatefulRuleDirection
$sel:direction:Header' :: Header -> StatefulRuleDirection
direction} -> StatefulRuleDirection
direction) (\s :: Header
s@Header' {} StatefulRuleDirection
a -> Header
s {$sel:direction:Header' :: StatefulRuleDirection
direction = StatefulRuleDirection
a} :: Header)
header_destination :: Lens.Lens' Header Prelude.Text
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Header' {Text
destination :: Text
$sel:destination:Header' :: Header -> Text
destination} -> Text
destination) (\s :: Header
s@Header' {} Text
a -> Header
s {$sel:destination:Header' :: Text
destination = Text
a} :: Header)
header_destinationPort :: Lens.Lens' Header Prelude.Text
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Header' {Text
destinationPort :: Text
$sel:destinationPort:Header' :: Header -> Text
destinationPort} -> Text
destinationPort) (\s :: Header
s@Header' {} Text
a -> Header
s {$sel:destinationPort:Header' :: Text
destinationPort = Text
a} :: Header)
instance Data.FromJSON Header where
parseJSON :: Value -> Parser Header
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Header"
( \Object
x ->
StatefulRuleProtocol
-> Text -> Text -> StatefulRuleDirection -> Text -> Text -> Header
Header'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Protocol")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Source")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SourcePort")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Direction")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Destination")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DestinationPort")
)
instance Prelude.Hashable Header where
hashWithSalt :: Int -> Header -> Int
hashWithSalt Int
_salt Header' {Text
StatefulRuleDirection
StatefulRuleProtocol
destinationPort :: Text
destination :: Text
direction :: StatefulRuleDirection
sourcePort :: Text
source :: Text
protocol :: StatefulRuleProtocol
$sel:destinationPort:Header' :: Header -> Text
$sel:destination:Header' :: Header -> Text
$sel:direction:Header' :: Header -> StatefulRuleDirection
$sel:sourcePort:Header' :: Header -> Text
$sel:source:Header' :: Header -> Text
$sel:protocol:Header' :: Header -> StatefulRuleProtocol
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StatefulRuleProtocol
protocol
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
source
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourcePort
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StatefulRuleDirection
direction
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destination
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationPort
instance Prelude.NFData Header where
rnf :: Header -> ()
rnf Header' {Text
StatefulRuleDirection
StatefulRuleProtocol
destinationPort :: Text
destination :: Text
direction :: StatefulRuleDirection
sourcePort :: Text
source :: Text
protocol :: StatefulRuleProtocol
$sel:destinationPort:Header' :: Header -> Text
$sel:destination:Header' :: Header -> Text
$sel:direction:Header' :: Header -> StatefulRuleDirection
$sel:sourcePort:Header' :: Header -> Text
$sel:source:Header' :: Header -> Text
$sel:protocol:Header' :: Header -> StatefulRuleProtocol
..} =
forall a. NFData a => a -> ()
Prelude.rnf StatefulRuleProtocol
protocol
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
source
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourcePort
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StatefulRuleDirection
direction
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destination
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destinationPort
instance Data.ToJSON Header where
toJSON :: Header -> Value
toJSON Header' {Text
StatefulRuleDirection
StatefulRuleProtocol
destinationPort :: Text
destination :: Text
direction :: StatefulRuleDirection
sourcePort :: Text
source :: Text
protocol :: StatefulRuleProtocol
$sel:destinationPort:Header' :: Header -> Text
$sel:destination:Header' :: Header -> Text
$sel:direction:Header' :: Header -> StatefulRuleDirection
$sel:sourcePort:Header' :: Header -> Text
$sel:source:Header' :: Header -> Text
$sel:protocol:Header' :: Header -> StatefulRuleProtocol
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Protocol" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= StatefulRuleProtocol
protocol),
forall a. a -> Maybe a
Prelude.Just (Key
"Source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
source),
forall a. a -> Maybe a
Prelude.Just (Key
"SourcePort" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sourcePort),
forall a. a -> Maybe a
Prelude.Just (Key
"Direction" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= StatefulRuleDirection
direction),
forall a. a -> Maybe a
Prelude.Just (Key
"Destination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
destination),
forall a. a -> Maybe a
Prelude.Just
(Key
"DestinationPort" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
destinationPort)
]
)