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