{-# 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.WAFV2.Types.RuleGroupReferenceStatement where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFV2.Types.ExcludedRule
import Amazonka.WAFV2.Types.RuleActionOverride
data RuleGroupReferenceStatement = RuleGroupReferenceStatement'
{
RuleGroupReferenceStatement -> Maybe [ExcludedRule]
excludedRules :: Prelude.Maybe [ExcludedRule],
RuleGroupReferenceStatement -> Maybe (NonEmpty RuleActionOverride)
ruleActionOverrides :: Prelude.Maybe (Prelude.NonEmpty RuleActionOverride),
RuleGroupReferenceStatement -> Text
arn :: Prelude.Text
}
deriving (RuleGroupReferenceStatement -> RuleGroupReferenceStatement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RuleGroupReferenceStatement -> RuleGroupReferenceStatement -> Bool
$c/= :: RuleGroupReferenceStatement -> RuleGroupReferenceStatement -> Bool
== :: RuleGroupReferenceStatement -> RuleGroupReferenceStatement -> Bool
$c== :: RuleGroupReferenceStatement -> RuleGroupReferenceStatement -> Bool
Prelude.Eq, ReadPrec [RuleGroupReferenceStatement]
ReadPrec RuleGroupReferenceStatement
Int -> ReadS RuleGroupReferenceStatement
ReadS [RuleGroupReferenceStatement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RuleGroupReferenceStatement]
$creadListPrec :: ReadPrec [RuleGroupReferenceStatement]
readPrec :: ReadPrec RuleGroupReferenceStatement
$creadPrec :: ReadPrec RuleGroupReferenceStatement
readList :: ReadS [RuleGroupReferenceStatement]
$creadList :: ReadS [RuleGroupReferenceStatement]
readsPrec :: Int -> ReadS RuleGroupReferenceStatement
$creadsPrec :: Int -> ReadS RuleGroupReferenceStatement
Prelude.Read, Int -> RuleGroupReferenceStatement -> ShowS
[RuleGroupReferenceStatement] -> ShowS
RuleGroupReferenceStatement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuleGroupReferenceStatement] -> ShowS
$cshowList :: [RuleGroupReferenceStatement] -> ShowS
show :: RuleGroupReferenceStatement -> String
$cshow :: RuleGroupReferenceStatement -> String
showsPrec :: Int -> RuleGroupReferenceStatement -> ShowS
$cshowsPrec :: Int -> RuleGroupReferenceStatement -> ShowS
Prelude.Show, forall x.
Rep RuleGroupReferenceStatement x -> RuleGroupReferenceStatement
forall x.
RuleGroupReferenceStatement -> Rep RuleGroupReferenceStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RuleGroupReferenceStatement x -> RuleGroupReferenceStatement
$cfrom :: forall x.
RuleGroupReferenceStatement -> Rep RuleGroupReferenceStatement x
Prelude.Generic)
newRuleGroupReferenceStatement ::
Prelude.Text ->
RuleGroupReferenceStatement
newRuleGroupReferenceStatement :: Text -> RuleGroupReferenceStatement
newRuleGroupReferenceStatement Text
pARN_ =
RuleGroupReferenceStatement'
{ $sel:excludedRules:RuleGroupReferenceStatement' :: Maybe [ExcludedRule]
excludedRules =
forall a. Maybe a
Prelude.Nothing,
$sel:ruleActionOverrides:RuleGroupReferenceStatement' :: Maybe (NonEmpty RuleActionOverride)
ruleActionOverrides = forall a. Maybe a
Prelude.Nothing,
$sel:arn:RuleGroupReferenceStatement' :: Text
arn = Text
pARN_
}
ruleGroupReferenceStatement_excludedRules :: Lens.Lens' RuleGroupReferenceStatement (Prelude.Maybe [ExcludedRule])
ruleGroupReferenceStatement_excludedRules :: Lens' RuleGroupReferenceStatement (Maybe [ExcludedRule])
ruleGroupReferenceStatement_excludedRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroupReferenceStatement' {Maybe [ExcludedRule]
excludedRules :: Maybe [ExcludedRule]
$sel:excludedRules:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Maybe [ExcludedRule]
excludedRules} -> Maybe [ExcludedRule]
excludedRules) (\s :: RuleGroupReferenceStatement
s@RuleGroupReferenceStatement' {} Maybe [ExcludedRule]
a -> RuleGroupReferenceStatement
s {$sel:excludedRules:RuleGroupReferenceStatement' :: Maybe [ExcludedRule]
excludedRules = Maybe [ExcludedRule]
a} :: RuleGroupReferenceStatement) 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
ruleGroupReferenceStatement_ruleActionOverrides :: Lens.Lens' RuleGroupReferenceStatement (Prelude.Maybe (Prelude.NonEmpty RuleActionOverride))
ruleGroupReferenceStatement_ruleActionOverrides :: Lens'
RuleGroupReferenceStatement (Maybe (NonEmpty RuleActionOverride))
ruleGroupReferenceStatement_ruleActionOverrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroupReferenceStatement' {Maybe (NonEmpty RuleActionOverride)
ruleActionOverrides :: Maybe (NonEmpty RuleActionOverride)
$sel:ruleActionOverrides:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Maybe (NonEmpty RuleActionOverride)
ruleActionOverrides} -> Maybe (NonEmpty RuleActionOverride)
ruleActionOverrides) (\s :: RuleGroupReferenceStatement
s@RuleGroupReferenceStatement' {} Maybe (NonEmpty RuleActionOverride)
a -> RuleGroupReferenceStatement
s {$sel:ruleActionOverrides:RuleGroupReferenceStatement' :: Maybe (NonEmpty RuleActionOverride)
ruleActionOverrides = Maybe (NonEmpty RuleActionOverride)
a} :: RuleGroupReferenceStatement) 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
ruleGroupReferenceStatement_arn :: Lens.Lens' RuleGroupReferenceStatement Prelude.Text
ruleGroupReferenceStatement_arn :: Lens' RuleGroupReferenceStatement Text
ruleGroupReferenceStatement_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroupReferenceStatement' {Text
arn :: Text
$sel:arn:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Text
arn} -> Text
arn) (\s :: RuleGroupReferenceStatement
s@RuleGroupReferenceStatement' {} Text
a -> RuleGroupReferenceStatement
s {$sel:arn:RuleGroupReferenceStatement' :: Text
arn = Text
a} :: RuleGroupReferenceStatement)
instance Data.FromJSON RuleGroupReferenceStatement where
parseJSON :: Value -> Parser RuleGroupReferenceStatement
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RuleGroupReferenceStatement"
( \Object
x ->
Maybe [ExcludedRule]
-> Maybe (NonEmpty RuleActionOverride)
-> Text
-> RuleGroupReferenceStatement
RuleGroupReferenceStatement'
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
"ExcludedRules" 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
"RuleActionOverrides")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ARN")
)
instance Prelude.Hashable RuleGroupReferenceStatement where
hashWithSalt :: Int -> RuleGroupReferenceStatement -> Int
hashWithSalt Int
_salt RuleGroupReferenceStatement' {Maybe [ExcludedRule]
Maybe (NonEmpty RuleActionOverride)
Text
arn :: Text
ruleActionOverrides :: Maybe (NonEmpty RuleActionOverride)
excludedRules :: Maybe [ExcludedRule]
$sel:arn:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Text
$sel:ruleActionOverrides:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Maybe (NonEmpty RuleActionOverride)
$sel:excludedRules:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Maybe [ExcludedRule]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ExcludedRule]
excludedRules
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty RuleActionOverride)
ruleActionOverrides
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
instance Prelude.NFData RuleGroupReferenceStatement where
rnf :: RuleGroupReferenceStatement -> ()
rnf RuleGroupReferenceStatement' {Maybe [ExcludedRule]
Maybe (NonEmpty RuleActionOverride)
Text
arn :: Text
ruleActionOverrides :: Maybe (NonEmpty RuleActionOverride)
excludedRules :: Maybe [ExcludedRule]
$sel:arn:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Text
$sel:ruleActionOverrides:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Maybe (NonEmpty RuleActionOverride)
$sel:excludedRules:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Maybe [ExcludedRule]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ExcludedRule]
excludedRules
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty RuleActionOverride)
ruleActionOverrides
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
instance Data.ToJSON RuleGroupReferenceStatement where
toJSON :: RuleGroupReferenceStatement -> Value
toJSON RuleGroupReferenceStatement' {Maybe [ExcludedRule]
Maybe (NonEmpty RuleActionOverride)
Text
arn :: Text
ruleActionOverrides :: Maybe (NonEmpty RuleActionOverride)
excludedRules :: Maybe [ExcludedRule]
$sel:arn:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Text
$sel:ruleActionOverrides:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Maybe (NonEmpty RuleActionOverride)
$sel:excludedRules:RuleGroupReferenceStatement' :: RuleGroupReferenceStatement -> Maybe [ExcludedRule]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ExcludedRules" 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 [ExcludedRule]
excludedRules,
(Key
"RuleActionOverrides" 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 (NonEmpty RuleActionOverride)
ruleActionOverrides,
forall a. a -> Maybe a
Prelude.Just (Key
"ARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)
]
)