{-# 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.RulesSource 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.RulesSourceList
import Amazonka.NetworkFirewall.Types.StatefulRule
import Amazonka.NetworkFirewall.Types.StatelessRulesAndCustomActions
import qualified Amazonka.Prelude as Prelude
data RulesSource = RulesSource'
{
RulesSource -> Maybe RulesSourceList
rulesSourceList :: Prelude.Maybe RulesSourceList,
RulesSource -> Maybe Text
rulesString :: Prelude.Maybe Prelude.Text,
RulesSource -> Maybe [StatefulRule]
statefulRules :: Prelude.Maybe [StatefulRule],
RulesSource -> Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions :: Prelude.Maybe StatelessRulesAndCustomActions
}
deriving (RulesSource -> RulesSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RulesSource -> RulesSource -> Bool
$c/= :: RulesSource -> RulesSource -> Bool
== :: RulesSource -> RulesSource -> Bool
$c== :: RulesSource -> RulesSource -> Bool
Prelude.Eq, ReadPrec [RulesSource]
ReadPrec RulesSource
Int -> ReadS RulesSource
ReadS [RulesSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RulesSource]
$creadListPrec :: ReadPrec [RulesSource]
readPrec :: ReadPrec RulesSource
$creadPrec :: ReadPrec RulesSource
readList :: ReadS [RulesSource]
$creadList :: ReadS [RulesSource]
readsPrec :: Int -> ReadS RulesSource
$creadsPrec :: Int -> ReadS RulesSource
Prelude.Read, Int -> RulesSource -> ShowS
[RulesSource] -> ShowS
RulesSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RulesSource] -> ShowS
$cshowList :: [RulesSource] -> ShowS
show :: RulesSource -> String
$cshow :: RulesSource -> String
showsPrec :: Int -> RulesSource -> ShowS
$cshowsPrec :: Int -> RulesSource -> ShowS
Prelude.Show, forall x. Rep RulesSource x -> RulesSource
forall x. RulesSource -> Rep RulesSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RulesSource x -> RulesSource
$cfrom :: forall x. RulesSource -> Rep RulesSource x
Prelude.Generic)
newRulesSource ::
RulesSource
newRulesSource :: RulesSource
newRulesSource =
RulesSource'
{ $sel:rulesSourceList:RulesSource' :: Maybe RulesSourceList
rulesSourceList = forall a. Maybe a
Prelude.Nothing,
$sel:rulesString:RulesSource' :: Maybe Text
rulesString = forall a. Maybe a
Prelude.Nothing,
$sel:statefulRules:RulesSource' :: Maybe [StatefulRule]
statefulRules = forall a. Maybe a
Prelude.Nothing,
$sel:statelessRulesAndCustomActions:RulesSource' :: Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions = forall a. Maybe a
Prelude.Nothing
}
rulesSource_rulesSourceList :: Lens.Lens' RulesSource (Prelude.Maybe RulesSourceList)
rulesSource_rulesSourceList :: Lens' RulesSource (Maybe RulesSourceList)
rulesSource_rulesSourceList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesSource' {Maybe RulesSourceList
rulesSourceList :: Maybe RulesSourceList
$sel:rulesSourceList:RulesSource' :: RulesSource -> Maybe RulesSourceList
rulesSourceList} -> Maybe RulesSourceList
rulesSourceList) (\s :: RulesSource
s@RulesSource' {} Maybe RulesSourceList
a -> RulesSource
s {$sel:rulesSourceList:RulesSource' :: Maybe RulesSourceList
rulesSourceList = Maybe RulesSourceList
a} :: RulesSource)
rulesSource_rulesString :: Lens.Lens' RulesSource (Prelude.Maybe Prelude.Text)
rulesSource_rulesString :: Lens' RulesSource (Maybe Text)
rulesSource_rulesString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesSource' {Maybe Text
rulesString :: Maybe Text
$sel:rulesString:RulesSource' :: RulesSource -> Maybe Text
rulesString} -> Maybe Text
rulesString) (\s :: RulesSource
s@RulesSource' {} Maybe Text
a -> RulesSource
s {$sel:rulesString:RulesSource' :: Maybe Text
rulesString = Maybe Text
a} :: RulesSource)
rulesSource_statefulRules :: Lens.Lens' RulesSource (Prelude.Maybe [StatefulRule])
rulesSource_statefulRules :: Lens' RulesSource (Maybe [StatefulRule])
rulesSource_statefulRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesSource' {Maybe [StatefulRule]
statefulRules :: Maybe [StatefulRule]
$sel:statefulRules:RulesSource' :: RulesSource -> Maybe [StatefulRule]
statefulRules} -> Maybe [StatefulRule]
statefulRules) (\s :: RulesSource
s@RulesSource' {} Maybe [StatefulRule]
a -> RulesSource
s {$sel:statefulRules:RulesSource' :: Maybe [StatefulRule]
statefulRules = Maybe [StatefulRule]
a} :: RulesSource) 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
rulesSource_statelessRulesAndCustomActions :: Lens.Lens' RulesSource (Prelude.Maybe StatelessRulesAndCustomActions)
rulesSource_statelessRulesAndCustomActions :: Lens' RulesSource (Maybe StatelessRulesAndCustomActions)
rulesSource_statelessRulesAndCustomActions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesSource' {Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions :: Maybe StatelessRulesAndCustomActions
$sel:statelessRulesAndCustomActions:RulesSource' :: RulesSource -> Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions} -> Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions) (\s :: RulesSource
s@RulesSource' {} Maybe StatelessRulesAndCustomActions
a -> RulesSource
s {$sel:statelessRulesAndCustomActions:RulesSource' :: Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions = Maybe StatelessRulesAndCustomActions
a} :: RulesSource)
instance Data.FromJSON RulesSource where
parseJSON :: Value -> Parser RulesSource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RulesSource"
( \Object
x ->
Maybe RulesSourceList
-> Maybe Text
-> Maybe [StatefulRule]
-> Maybe StatelessRulesAndCustomActions
-> RulesSource
RulesSource'
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
"RulesSourceList")
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
"RulesString")
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
"StatefulRules" 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
"StatelessRulesAndCustomActions")
)
instance Prelude.Hashable RulesSource where
hashWithSalt :: Int -> RulesSource -> Int
hashWithSalt Int
_salt RulesSource' {Maybe [StatefulRule]
Maybe Text
Maybe StatelessRulesAndCustomActions
Maybe RulesSourceList
statelessRulesAndCustomActions :: Maybe StatelessRulesAndCustomActions
statefulRules :: Maybe [StatefulRule]
rulesString :: Maybe Text
rulesSourceList :: Maybe RulesSourceList
$sel:statelessRulesAndCustomActions:RulesSource' :: RulesSource -> Maybe StatelessRulesAndCustomActions
$sel:statefulRules:RulesSource' :: RulesSource -> Maybe [StatefulRule]
$sel:rulesString:RulesSource' :: RulesSource -> Maybe Text
$sel:rulesSourceList:RulesSource' :: RulesSource -> Maybe RulesSourceList
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RulesSourceList
rulesSourceList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rulesString
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [StatefulRule]
statefulRules
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions
instance Prelude.NFData RulesSource where
rnf :: RulesSource -> ()
rnf RulesSource' {Maybe [StatefulRule]
Maybe Text
Maybe StatelessRulesAndCustomActions
Maybe RulesSourceList
statelessRulesAndCustomActions :: Maybe StatelessRulesAndCustomActions
statefulRules :: Maybe [StatefulRule]
rulesString :: Maybe Text
rulesSourceList :: Maybe RulesSourceList
$sel:statelessRulesAndCustomActions:RulesSource' :: RulesSource -> Maybe StatelessRulesAndCustomActions
$sel:statefulRules:RulesSource' :: RulesSource -> Maybe [StatefulRule]
$sel:rulesString:RulesSource' :: RulesSource -> Maybe Text
$sel:rulesSourceList:RulesSource' :: RulesSource -> Maybe RulesSourceList
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe RulesSourceList
rulesSourceList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rulesString
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [StatefulRule]
statefulRules
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions
instance Data.ToJSON RulesSource where
toJSON :: RulesSource -> Value
toJSON RulesSource' {Maybe [StatefulRule]
Maybe Text
Maybe StatelessRulesAndCustomActions
Maybe RulesSourceList
statelessRulesAndCustomActions :: Maybe StatelessRulesAndCustomActions
statefulRules :: Maybe [StatefulRule]
rulesString :: Maybe Text
rulesSourceList :: Maybe RulesSourceList
$sel:statelessRulesAndCustomActions:RulesSource' :: RulesSource -> Maybe StatelessRulesAndCustomActions
$sel:statefulRules:RulesSource' :: RulesSource -> Maybe [StatefulRule]
$sel:rulesString:RulesSource' :: RulesSource -> Maybe Text
$sel:rulesSourceList:RulesSource' :: RulesSource -> Maybe RulesSourceList
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"RulesSourceList" 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 RulesSourceList
rulesSourceList,
(Key
"RulesString" 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 Text
rulesString,
(Key
"StatefulRules" 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 [StatefulRule]
statefulRules,
(Key
"StatelessRulesAndCustomActions" 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 StatelessRulesAndCustomActions
statelessRulesAndCustomActions
]
)