{-# 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.Lens as Lens
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 Text
rulesString :: Prelude.Maybe Prelude.Text,
RulesSource -> Maybe RulesSourceList
rulesSourceList :: Prelude.Maybe RulesSourceList,
RulesSource -> Maybe [StatefulRule]
statefulRules :: Prelude.Maybe [StatefulRule],
RulesSource -> Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions :: Prelude.Maybe StatelessRulesAndCustomActions
}
deriving (RulesSource -> RulesSource -> Bool
(RulesSource -> RulesSource -> Bool)
-> (RulesSource -> RulesSource -> Bool) -> Eq RulesSource
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]
(Int -> ReadS RulesSource)
-> ReadS [RulesSource]
-> ReadPrec RulesSource
-> ReadPrec [RulesSource]
-> Read 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
(Int -> RulesSource -> ShowS)
-> (RulesSource -> String)
-> ([RulesSource] -> ShowS)
-> Show RulesSource
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. RulesSource -> Rep RulesSource x)
-> (forall x. Rep RulesSource x -> RulesSource)
-> Generic RulesSource
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' :: Maybe Text
-> Maybe RulesSourceList
-> Maybe [StatefulRule]
-> Maybe StatelessRulesAndCustomActions
-> RulesSource
RulesSource'
{ $sel:rulesString:RulesSource' :: Maybe Text
rulesString = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:rulesSourceList:RulesSource' :: Maybe RulesSourceList
rulesSourceList = Maybe RulesSourceList
forall a. Maybe a
Prelude.Nothing,
$sel:statefulRules:RulesSource' :: Maybe [StatefulRule]
statefulRules = Maybe [StatefulRule]
forall a. Maybe a
Prelude.Nothing,
$sel:statelessRulesAndCustomActions:RulesSource' :: Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions = Maybe StatelessRulesAndCustomActions
forall a. Maybe a
Prelude.Nothing
}
rulesSource_rulesString :: Lens.Lens' RulesSource (Prelude.Maybe Prelude.Text)
rulesSource_rulesString :: (Maybe Text -> f (Maybe Text)) -> RulesSource -> f RulesSource
rulesSource_rulesString = (RulesSource -> Maybe Text)
-> (RulesSource -> Maybe Text -> RulesSource)
-> Lens RulesSource RulesSource (Maybe Text) (Maybe Text)
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_rulesSourceList :: Lens.Lens' RulesSource (Prelude.Maybe RulesSourceList)
rulesSource_rulesSourceList :: (Maybe RulesSourceList -> f (Maybe RulesSourceList))
-> RulesSource -> f RulesSource
rulesSource_rulesSourceList = (RulesSource -> Maybe RulesSourceList)
-> (RulesSource -> Maybe RulesSourceList -> RulesSource)
-> Lens
RulesSource
RulesSource
(Maybe RulesSourceList)
(Maybe 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_statefulRules :: Lens.Lens' RulesSource (Prelude.Maybe [StatefulRule])
rulesSource_statefulRules :: (Maybe [StatefulRule] -> f (Maybe [StatefulRule]))
-> RulesSource -> f RulesSource
rulesSource_statefulRules = (RulesSource -> Maybe [StatefulRule])
-> (RulesSource -> Maybe [StatefulRule] -> RulesSource)
-> Lens
RulesSource
RulesSource
(Maybe [StatefulRule])
(Maybe [StatefulRule])
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) ((Maybe [StatefulRule] -> f (Maybe [StatefulRule]))
-> RulesSource -> f RulesSource)
-> ((Maybe [StatefulRule] -> f (Maybe [StatefulRule]))
-> Maybe [StatefulRule] -> f (Maybe [StatefulRule]))
-> (Maybe [StatefulRule] -> f (Maybe [StatefulRule]))
-> RulesSource
-> f RulesSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [StatefulRule] [StatefulRule] [StatefulRule] [StatefulRule]
-> Iso
(Maybe [StatefulRule])
(Maybe [StatefulRule])
(Maybe [StatefulRule])
(Maybe [StatefulRule])
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 [StatefulRule] [StatefulRule] [StatefulRule] [StatefulRule]
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 :: (Maybe StatelessRulesAndCustomActions
-> f (Maybe StatelessRulesAndCustomActions))
-> RulesSource -> f RulesSource
rulesSource_statelessRulesAndCustomActions = (RulesSource -> Maybe StatelessRulesAndCustomActions)
-> (RulesSource
-> Maybe StatelessRulesAndCustomActions -> RulesSource)
-> Lens
RulesSource
RulesSource
(Maybe StatelessRulesAndCustomActions)
(Maybe 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 Core.FromJSON RulesSource where
parseJSON :: Value -> Parser RulesSource
parseJSON =
String
-> (Object -> Parser RulesSource) -> Value -> Parser RulesSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RulesSource"
( \Object
x ->
Maybe Text
-> Maybe RulesSourceList
-> Maybe [StatefulRule]
-> Maybe StatelessRulesAndCustomActions
-> RulesSource
RulesSource'
(Maybe Text
-> Maybe RulesSourceList
-> Maybe [StatefulRule]
-> Maybe StatelessRulesAndCustomActions
-> RulesSource)
-> Parser (Maybe Text)
-> Parser
(Maybe RulesSourceList
-> Maybe [StatefulRule]
-> Maybe StatelessRulesAndCustomActions
-> RulesSource)
forall (f :: * -> *) a b. Functor 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
"RulesString")
Parser
(Maybe RulesSourceList
-> Maybe [StatefulRule]
-> Maybe StatelessRulesAndCustomActions
-> RulesSource)
-> Parser (Maybe RulesSourceList)
-> Parser
(Maybe [StatefulRule]
-> Maybe StatelessRulesAndCustomActions -> RulesSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RulesSourceList)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RulesSourceList")
Parser
(Maybe [StatefulRule]
-> Maybe StatelessRulesAndCustomActions -> RulesSource)
-> Parser (Maybe [StatefulRule])
-> Parser (Maybe StatelessRulesAndCustomActions -> RulesSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [StatefulRule]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatefulRules" Parser (Maybe (Maybe [StatefulRule]))
-> Maybe [StatefulRule] -> Parser (Maybe [StatefulRule])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [StatefulRule]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe StatelessRulesAndCustomActions -> RulesSource)
-> Parser (Maybe StatelessRulesAndCustomActions)
-> Parser RulesSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StatelessRulesAndCustomActions)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatelessRulesAndCustomActions")
)
instance Prelude.Hashable RulesSource
instance Prelude.NFData RulesSource
instance Core.ToJSON RulesSource where
toJSON :: RulesSource -> Value
toJSON RulesSource' {Maybe [StatefulRule]
Maybe Text
Maybe StatelessRulesAndCustomActions
Maybe RulesSourceList
statelessRulesAndCustomActions :: Maybe StatelessRulesAndCustomActions
statefulRules :: Maybe [StatefulRule]
rulesSourceList :: Maybe RulesSourceList
rulesString :: Maybe Text
$sel:statelessRulesAndCustomActions:RulesSource' :: RulesSource -> Maybe StatelessRulesAndCustomActions
$sel:statefulRules:RulesSource' :: RulesSource -> Maybe [StatefulRule]
$sel:rulesSourceList:RulesSource' :: RulesSource -> Maybe RulesSourceList
$sel:rulesString:RulesSource' :: RulesSource -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RulesString" 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
rulesString,
(Text
"RulesSourceList" Text -> RulesSourceList -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RulesSourceList -> Pair) -> Maybe RulesSourceList -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RulesSourceList
rulesSourceList,
(Text
"StatefulRules" Text -> [StatefulRule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([StatefulRule] -> Pair) -> Maybe [StatefulRule] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StatefulRule]
statefulRules,
(Text
"StatelessRulesAndCustomActions" Text -> StatelessRulesAndCustomActions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(StatelessRulesAndCustomActions -> Pair)
-> Maybe StatelessRulesAndCustomActions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StatelessRulesAndCustomActions
statelessRulesAndCustomActions
]
)