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