{-# 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.SecurityHub.Types.AwsWafWebAclRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.WafAction
import Amazonka.SecurityHub.Types.WafExcludedRule
import Amazonka.SecurityHub.Types.WafOverrideAction
data AwsWafWebAclRule = AwsWafWebAclRule'
{
AwsWafWebAclRule -> Maybe Int
priority :: Prelude.Maybe Prelude.Int,
AwsWafWebAclRule -> Maybe WafOverrideAction
overrideAction :: Prelude.Maybe WafOverrideAction,
AwsWafWebAclRule -> Maybe Text
ruleId :: Prelude.Maybe Prelude.Text,
AwsWafWebAclRule -> Maybe WafAction
action :: Prelude.Maybe WafAction,
AwsWafWebAclRule -> Maybe [WafExcludedRule]
excludedRules :: Prelude.Maybe [WafExcludedRule],
AwsWafWebAclRule -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
}
deriving (AwsWafWebAclRule -> AwsWafWebAclRule -> Bool
(AwsWafWebAclRule -> AwsWafWebAclRule -> Bool)
-> (AwsWafWebAclRule -> AwsWafWebAclRule -> Bool)
-> Eq AwsWafWebAclRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsWafWebAclRule -> AwsWafWebAclRule -> Bool
$c/= :: AwsWafWebAclRule -> AwsWafWebAclRule -> Bool
== :: AwsWafWebAclRule -> AwsWafWebAclRule -> Bool
$c== :: AwsWafWebAclRule -> AwsWafWebAclRule -> Bool
Prelude.Eq, ReadPrec [AwsWafWebAclRule]
ReadPrec AwsWafWebAclRule
Int -> ReadS AwsWafWebAclRule
ReadS [AwsWafWebAclRule]
(Int -> ReadS AwsWafWebAclRule)
-> ReadS [AwsWafWebAclRule]
-> ReadPrec AwsWafWebAclRule
-> ReadPrec [AwsWafWebAclRule]
-> Read AwsWafWebAclRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsWafWebAclRule]
$creadListPrec :: ReadPrec [AwsWafWebAclRule]
readPrec :: ReadPrec AwsWafWebAclRule
$creadPrec :: ReadPrec AwsWafWebAclRule
readList :: ReadS [AwsWafWebAclRule]
$creadList :: ReadS [AwsWafWebAclRule]
readsPrec :: Int -> ReadS AwsWafWebAclRule
$creadsPrec :: Int -> ReadS AwsWafWebAclRule
Prelude.Read, Int -> AwsWafWebAclRule -> ShowS
[AwsWafWebAclRule] -> ShowS
AwsWafWebAclRule -> String
(Int -> AwsWafWebAclRule -> ShowS)
-> (AwsWafWebAclRule -> String)
-> ([AwsWafWebAclRule] -> ShowS)
-> Show AwsWafWebAclRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsWafWebAclRule] -> ShowS
$cshowList :: [AwsWafWebAclRule] -> ShowS
show :: AwsWafWebAclRule -> String
$cshow :: AwsWafWebAclRule -> String
showsPrec :: Int -> AwsWafWebAclRule -> ShowS
$cshowsPrec :: Int -> AwsWafWebAclRule -> ShowS
Prelude.Show, (forall x. AwsWafWebAclRule -> Rep AwsWafWebAclRule x)
-> (forall x. Rep AwsWafWebAclRule x -> AwsWafWebAclRule)
-> Generic AwsWafWebAclRule
forall x. Rep AwsWafWebAclRule x -> AwsWafWebAclRule
forall x. AwsWafWebAclRule -> Rep AwsWafWebAclRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsWafWebAclRule x -> AwsWafWebAclRule
$cfrom :: forall x. AwsWafWebAclRule -> Rep AwsWafWebAclRule x
Prelude.Generic)
newAwsWafWebAclRule ::
AwsWafWebAclRule
newAwsWafWebAclRule :: AwsWafWebAclRule
newAwsWafWebAclRule =
AwsWafWebAclRule' :: Maybe Int
-> Maybe WafOverrideAction
-> Maybe Text
-> Maybe WafAction
-> Maybe [WafExcludedRule]
-> Maybe Text
-> AwsWafWebAclRule
AwsWafWebAclRule'
{ $sel:priority:AwsWafWebAclRule' :: Maybe Int
priority = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:overrideAction:AwsWafWebAclRule' :: Maybe WafOverrideAction
overrideAction = Maybe WafOverrideAction
forall a. Maybe a
Prelude.Nothing,
$sel:ruleId:AwsWafWebAclRule' :: Maybe Text
ruleId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:action:AwsWafWebAclRule' :: Maybe WafAction
action = Maybe WafAction
forall a. Maybe a
Prelude.Nothing,
$sel:excludedRules:AwsWafWebAclRule' :: Maybe [WafExcludedRule]
excludedRules = Maybe [WafExcludedRule]
forall a. Maybe a
Prelude.Nothing,
$sel:type':AwsWafWebAclRule' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
awsWafWebAclRule_priority :: Lens.Lens' AwsWafWebAclRule (Prelude.Maybe Prelude.Int)
awsWafWebAclRule_priority :: (Maybe Int -> f (Maybe Int))
-> AwsWafWebAclRule -> f AwsWafWebAclRule
awsWafWebAclRule_priority = (AwsWafWebAclRule -> Maybe Int)
-> (AwsWafWebAclRule -> Maybe Int -> AwsWafWebAclRule)
-> Lens AwsWafWebAclRule AwsWafWebAclRule (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsWafWebAclRule' {Maybe Int
priority :: Maybe Int
$sel:priority:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe Int
priority} -> Maybe Int
priority) (\s :: AwsWafWebAclRule
s@AwsWafWebAclRule' {} Maybe Int
a -> AwsWafWebAclRule
s {$sel:priority:AwsWafWebAclRule' :: Maybe Int
priority = Maybe Int
a} :: AwsWafWebAclRule)
awsWafWebAclRule_overrideAction :: Lens.Lens' AwsWafWebAclRule (Prelude.Maybe WafOverrideAction)
awsWafWebAclRule_overrideAction :: (Maybe WafOverrideAction -> f (Maybe WafOverrideAction))
-> AwsWafWebAclRule -> f AwsWafWebAclRule
awsWafWebAclRule_overrideAction = (AwsWafWebAclRule -> Maybe WafOverrideAction)
-> (AwsWafWebAclRule
-> Maybe WafOverrideAction -> AwsWafWebAclRule)
-> Lens
AwsWafWebAclRule
AwsWafWebAclRule
(Maybe WafOverrideAction)
(Maybe WafOverrideAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsWafWebAclRule' {Maybe WafOverrideAction
overrideAction :: Maybe WafOverrideAction
$sel:overrideAction:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe WafOverrideAction
overrideAction} -> Maybe WafOverrideAction
overrideAction) (\s :: AwsWafWebAclRule
s@AwsWafWebAclRule' {} Maybe WafOverrideAction
a -> AwsWafWebAclRule
s {$sel:overrideAction:AwsWafWebAclRule' :: Maybe WafOverrideAction
overrideAction = Maybe WafOverrideAction
a} :: AwsWafWebAclRule)
awsWafWebAclRule_ruleId :: Lens.Lens' AwsWafWebAclRule (Prelude.Maybe Prelude.Text)
awsWafWebAclRule_ruleId :: (Maybe Text -> f (Maybe Text))
-> AwsWafWebAclRule -> f AwsWafWebAclRule
awsWafWebAclRule_ruleId = (AwsWafWebAclRule -> Maybe Text)
-> (AwsWafWebAclRule -> Maybe Text -> AwsWafWebAclRule)
-> Lens AwsWafWebAclRule AwsWafWebAclRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsWafWebAclRule' {Maybe Text
ruleId :: Maybe Text
$sel:ruleId:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe Text
ruleId} -> Maybe Text
ruleId) (\s :: AwsWafWebAclRule
s@AwsWafWebAclRule' {} Maybe Text
a -> AwsWafWebAclRule
s {$sel:ruleId:AwsWafWebAclRule' :: Maybe Text
ruleId = Maybe Text
a} :: AwsWafWebAclRule)
awsWafWebAclRule_action :: Lens.Lens' AwsWafWebAclRule (Prelude.Maybe WafAction)
awsWafWebAclRule_action :: (Maybe WafAction -> f (Maybe WafAction))
-> AwsWafWebAclRule -> f AwsWafWebAclRule
awsWafWebAclRule_action = (AwsWafWebAclRule -> Maybe WafAction)
-> (AwsWafWebAclRule -> Maybe WafAction -> AwsWafWebAclRule)
-> Lens
AwsWafWebAclRule
AwsWafWebAclRule
(Maybe WafAction)
(Maybe WafAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsWafWebAclRule' {Maybe WafAction
action :: Maybe WafAction
$sel:action:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe WafAction
action} -> Maybe WafAction
action) (\s :: AwsWafWebAclRule
s@AwsWafWebAclRule' {} Maybe WafAction
a -> AwsWafWebAclRule
s {$sel:action:AwsWafWebAclRule' :: Maybe WafAction
action = Maybe WafAction
a} :: AwsWafWebAclRule)
awsWafWebAclRule_excludedRules :: Lens.Lens' AwsWafWebAclRule (Prelude.Maybe [WafExcludedRule])
awsWafWebAclRule_excludedRules :: (Maybe [WafExcludedRule] -> f (Maybe [WafExcludedRule]))
-> AwsWafWebAclRule -> f AwsWafWebAclRule
awsWafWebAclRule_excludedRules = (AwsWafWebAclRule -> Maybe [WafExcludedRule])
-> (AwsWafWebAclRule
-> Maybe [WafExcludedRule] -> AwsWafWebAclRule)
-> Lens
AwsWafWebAclRule
AwsWafWebAclRule
(Maybe [WafExcludedRule])
(Maybe [WafExcludedRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsWafWebAclRule' {Maybe [WafExcludedRule]
excludedRules :: Maybe [WafExcludedRule]
$sel:excludedRules:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe [WafExcludedRule]
excludedRules} -> Maybe [WafExcludedRule]
excludedRules) (\s :: AwsWafWebAclRule
s@AwsWafWebAclRule' {} Maybe [WafExcludedRule]
a -> AwsWafWebAclRule
s {$sel:excludedRules:AwsWafWebAclRule' :: Maybe [WafExcludedRule]
excludedRules = Maybe [WafExcludedRule]
a} :: AwsWafWebAclRule) ((Maybe [WafExcludedRule] -> f (Maybe [WafExcludedRule]))
-> AwsWafWebAclRule -> f AwsWafWebAclRule)
-> ((Maybe [WafExcludedRule] -> f (Maybe [WafExcludedRule]))
-> Maybe [WafExcludedRule] -> f (Maybe [WafExcludedRule]))
-> (Maybe [WafExcludedRule] -> f (Maybe [WafExcludedRule]))
-> AwsWafWebAclRule
-> f AwsWafWebAclRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[WafExcludedRule]
[WafExcludedRule]
[WafExcludedRule]
[WafExcludedRule]
-> Iso
(Maybe [WafExcludedRule])
(Maybe [WafExcludedRule])
(Maybe [WafExcludedRule])
(Maybe [WafExcludedRule])
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
[WafExcludedRule]
[WafExcludedRule]
[WafExcludedRule]
[WafExcludedRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
awsWafWebAclRule_type :: Lens.Lens' AwsWafWebAclRule (Prelude.Maybe Prelude.Text)
awsWafWebAclRule_type :: (Maybe Text -> f (Maybe Text))
-> AwsWafWebAclRule -> f AwsWafWebAclRule
awsWafWebAclRule_type = (AwsWafWebAclRule -> Maybe Text)
-> (AwsWafWebAclRule -> Maybe Text -> AwsWafWebAclRule)
-> Lens AwsWafWebAclRule AwsWafWebAclRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsWafWebAclRule' {Maybe Text
type' :: Maybe Text
$sel:type':AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe Text
type'} -> Maybe Text
type') (\s :: AwsWafWebAclRule
s@AwsWafWebAclRule' {} Maybe Text
a -> AwsWafWebAclRule
s {$sel:type':AwsWafWebAclRule' :: Maybe Text
type' = Maybe Text
a} :: AwsWafWebAclRule)
instance Core.FromJSON AwsWafWebAclRule where
parseJSON :: Value -> Parser AwsWafWebAclRule
parseJSON =
String
-> (Object -> Parser AwsWafWebAclRule)
-> Value
-> Parser AwsWafWebAclRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AwsWafWebAclRule"
( \Object
x ->
Maybe Int
-> Maybe WafOverrideAction
-> Maybe Text
-> Maybe WafAction
-> Maybe [WafExcludedRule]
-> Maybe Text
-> AwsWafWebAclRule
AwsWafWebAclRule'
(Maybe Int
-> Maybe WafOverrideAction
-> Maybe Text
-> Maybe WafAction
-> Maybe [WafExcludedRule]
-> Maybe Text
-> AwsWafWebAclRule)
-> Parser (Maybe Int)
-> Parser
(Maybe WafOverrideAction
-> Maybe Text
-> Maybe WafAction
-> Maybe [WafExcludedRule]
-> Maybe Text
-> AwsWafWebAclRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Priority")
Parser
(Maybe WafOverrideAction
-> Maybe Text
-> Maybe WafAction
-> Maybe [WafExcludedRule]
-> Maybe Text
-> AwsWafWebAclRule)
-> Parser (Maybe WafOverrideAction)
-> Parser
(Maybe Text
-> Maybe WafAction
-> Maybe [WafExcludedRule]
-> Maybe Text
-> AwsWafWebAclRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe WafOverrideAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OverrideAction")
Parser
(Maybe Text
-> Maybe WafAction
-> Maybe [WafExcludedRule]
-> Maybe Text
-> AwsWafWebAclRule)
-> Parser (Maybe Text)
-> Parser
(Maybe WafAction
-> Maybe [WafExcludedRule] -> Maybe Text -> AwsWafWebAclRule)
forall (f :: * -> *) a b. Applicative f => 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
"RuleId")
Parser
(Maybe WafAction
-> Maybe [WafExcludedRule] -> Maybe Text -> AwsWafWebAclRule)
-> Parser (Maybe WafAction)
-> Parser
(Maybe [WafExcludedRule] -> Maybe Text -> AwsWafWebAclRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe WafAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Action")
Parser (Maybe [WafExcludedRule] -> Maybe Text -> AwsWafWebAclRule)
-> Parser (Maybe [WafExcludedRule])
-> Parser (Maybe Text -> AwsWafWebAclRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [WafExcludedRule]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExcludedRules" Parser (Maybe (Maybe [WafExcludedRule]))
-> Maybe [WafExcludedRule] -> Parser (Maybe [WafExcludedRule])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [WafExcludedRule]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> AwsWafWebAclRule)
-> Parser (Maybe Text) -> Parser AwsWafWebAclRule
forall (f :: * -> *) a b. Applicative f => 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
"Type")
)
instance Prelude.Hashable AwsWafWebAclRule
instance Prelude.NFData AwsWafWebAclRule
instance Core.ToJSON AwsWafWebAclRule where
toJSON :: AwsWafWebAclRule -> Value
toJSON AwsWafWebAclRule' {Maybe Int
Maybe [WafExcludedRule]
Maybe Text
Maybe WafAction
Maybe WafOverrideAction
type' :: Maybe Text
excludedRules :: Maybe [WafExcludedRule]
action :: Maybe WafAction
ruleId :: Maybe Text
overrideAction :: Maybe WafOverrideAction
priority :: Maybe Int
$sel:type':AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe Text
$sel:excludedRules:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe [WafExcludedRule]
$sel:action:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe WafAction
$sel:ruleId:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe Text
$sel:overrideAction:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe WafOverrideAction
$sel:priority:AwsWafWebAclRule' :: AwsWafWebAclRule -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Priority" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
priority,
(Text
"OverrideAction" Text -> WafOverrideAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(WafOverrideAction -> Pair)
-> Maybe WafOverrideAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WafOverrideAction
overrideAction,
(Text
"RuleId" 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
ruleId,
(Text
"Action" Text -> WafAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (WafAction -> Pair) -> Maybe WafAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WafAction
action,
(Text
"ExcludedRules" Text -> [WafExcludedRule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([WafExcludedRule] -> Pair)
-> Maybe [WafExcludedRule] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [WafExcludedRule]
excludedRules,
(Text
"Type" 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
type'
]
)