{-# 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.RuleVariables 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.IPSet
import Amazonka.NetworkFirewall.Types.PortSet
import qualified Amazonka.Prelude as Prelude
data RuleVariables = RuleVariables'
{
RuleVariables -> Maybe (HashMap Text IPSet)
iPSets :: Prelude.Maybe (Prelude.HashMap Prelude.Text IPSet),
RuleVariables -> Maybe (HashMap Text PortSet)
portSets :: Prelude.Maybe (Prelude.HashMap Prelude.Text PortSet)
}
deriving (RuleVariables -> RuleVariables -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RuleVariables -> RuleVariables -> Bool
$c/= :: RuleVariables -> RuleVariables -> Bool
== :: RuleVariables -> RuleVariables -> Bool
$c== :: RuleVariables -> RuleVariables -> Bool
Prelude.Eq, ReadPrec [RuleVariables]
ReadPrec RuleVariables
Int -> ReadS RuleVariables
ReadS [RuleVariables]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RuleVariables]
$creadListPrec :: ReadPrec [RuleVariables]
readPrec :: ReadPrec RuleVariables
$creadPrec :: ReadPrec RuleVariables
readList :: ReadS [RuleVariables]
$creadList :: ReadS [RuleVariables]
readsPrec :: Int -> ReadS RuleVariables
$creadsPrec :: Int -> ReadS RuleVariables
Prelude.Read, Int -> RuleVariables -> ShowS
[RuleVariables] -> ShowS
RuleVariables -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuleVariables] -> ShowS
$cshowList :: [RuleVariables] -> ShowS
show :: RuleVariables -> String
$cshow :: RuleVariables -> String
showsPrec :: Int -> RuleVariables -> ShowS
$cshowsPrec :: Int -> RuleVariables -> ShowS
Prelude.Show, forall x. Rep RuleVariables x -> RuleVariables
forall x. RuleVariables -> Rep RuleVariables x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RuleVariables x -> RuleVariables
$cfrom :: forall x. RuleVariables -> Rep RuleVariables x
Prelude.Generic)
newRuleVariables ::
RuleVariables
newRuleVariables :: RuleVariables
newRuleVariables =
RuleVariables'
{ $sel:iPSets:RuleVariables' :: Maybe (HashMap Text IPSet)
iPSets = forall a. Maybe a
Prelude.Nothing,
$sel:portSets:RuleVariables' :: Maybe (HashMap Text PortSet)
portSets = forall a. Maybe a
Prelude.Nothing
}
ruleVariables_iPSets :: Lens.Lens' RuleVariables (Prelude.Maybe (Prelude.HashMap Prelude.Text IPSet))
ruleVariables_iPSets :: Lens' RuleVariables (Maybe (HashMap Text IPSet))
ruleVariables_iPSets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleVariables' {Maybe (HashMap Text IPSet)
iPSets :: Maybe (HashMap Text IPSet)
$sel:iPSets:RuleVariables' :: RuleVariables -> Maybe (HashMap Text IPSet)
iPSets} -> Maybe (HashMap Text IPSet)
iPSets) (\s :: RuleVariables
s@RuleVariables' {} Maybe (HashMap Text IPSet)
a -> RuleVariables
s {$sel:iPSets:RuleVariables' :: Maybe (HashMap Text IPSet)
iPSets = Maybe (HashMap Text IPSet)
a} :: RuleVariables) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
ruleVariables_portSets :: Lens.Lens' RuleVariables (Prelude.Maybe (Prelude.HashMap Prelude.Text PortSet))
ruleVariables_portSets :: Lens' RuleVariables (Maybe (HashMap Text PortSet))
ruleVariables_portSets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleVariables' {Maybe (HashMap Text PortSet)
portSets :: Maybe (HashMap Text PortSet)
$sel:portSets:RuleVariables' :: RuleVariables -> Maybe (HashMap Text PortSet)
portSets} -> Maybe (HashMap Text PortSet)
portSets) (\s :: RuleVariables
s@RuleVariables' {} Maybe (HashMap Text PortSet)
a -> RuleVariables
s {$sel:portSets:RuleVariables' :: Maybe (HashMap Text PortSet)
portSets = Maybe (HashMap Text PortSet)
a} :: RuleVariables) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON RuleVariables where
parseJSON :: Value -> Parser RuleVariables
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RuleVariables"
( \Object
x ->
Maybe (HashMap Text IPSet)
-> Maybe (HashMap Text PortSet) -> RuleVariables
RuleVariables'
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
"IPSets" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"PortSets" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable RuleVariables where
hashWithSalt :: Int -> RuleVariables -> Int
hashWithSalt Int
_salt RuleVariables' {Maybe (HashMap Text IPSet)
Maybe (HashMap Text PortSet)
portSets :: Maybe (HashMap Text PortSet)
iPSets :: Maybe (HashMap Text IPSet)
$sel:portSets:RuleVariables' :: RuleVariables -> Maybe (HashMap Text PortSet)
$sel:iPSets:RuleVariables' :: RuleVariables -> Maybe (HashMap Text IPSet)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text IPSet)
iPSets
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text PortSet)
portSets
instance Prelude.NFData RuleVariables where
rnf :: RuleVariables -> ()
rnf RuleVariables' {Maybe (HashMap Text IPSet)
Maybe (HashMap Text PortSet)
portSets :: Maybe (HashMap Text PortSet)
iPSets :: Maybe (HashMap Text IPSet)
$sel:portSets:RuleVariables' :: RuleVariables -> Maybe (HashMap Text PortSet)
$sel:iPSets:RuleVariables' :: RuleVariables -> Maybe (HashMap Text IPSet)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text IPSet)
iPSets
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text PortSet)
portSets
instance Data.ToJSON RuleVariables where
toJSON :: RuleVariables -> Value
toJSON RuleVariables' {Maybe (HashMap Text IPSet)
Maybe (HashMap Text PortSet)
portSets :: Maybe (HashMap Text PortSet)
iPSets :: Maybe (HashMap Text IPSet)
$sel:portSets:RuleVariables' :: RuleVariables -> Maybe (HashMap Text PortSet)
$sel:iPSets:RuleVariables' :: RuleVariables -> Maybe (HashMap Text IPSet)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"IPSets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text IPSet)
iPSets,
(Key
"PortSets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text PortSet)
portSets
]
)