{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SecurityHub.Types.AwsWafWebAclRule
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
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

-- | Details for a rule in an WAF WebACL.
--
-- /See:/ 'newAwsWafWebAclRule' smart constructor.
data AwsWafWebAclRule = AwsWafWebAclRule'
  { -- | Specifies the order in which the rules in a WebACL are evaluated. Rules
    -- with a lower value for @Priority@ are evaluated before rules with a
    -- higher value. The value must be a unique integer. If you add multiple
    -- rules to a WebACL, the values do not need to be consecutive.
    AwsWafWebAclRule -> Maybe Int
priority :: Prelude.Maybe Prelude.Int,
    -- | Use the @OverrideAction@ to test your RuleGroup.
    --
    -- Any rule in a RuleGroup can potentially block a request. If you set the
    -- @OverrideAction@ to @None@, the RuleGroup blocks a request if any
    -- individual rule in the RuleGroup matches the request and is configured
    -- to block that request.
    --
    -- However, if you first want to test the RuleGroup, set the
    -- @OverrideAction@ to @Count@. The RuleGroup then overrides any block
    -- action specified by individual rules contained within the group. Instead
    -- of blocking matching requests, those requests are counted.
    --
    -- @ActivatedRule@|@OverrideAction@ applies only when updating or adding a
    -- RuleGroup to a WebACL. In this case you do not use
    -- @ActivatedRule@|@Action@. For all other update requests,
    -- @ActivatedRule@|@Action@ is used instead of
    -- @ActivatedRule@|@OverrideAction@.
    AwsWafWebAclRule -> Maybe WafOverrideAction
overrideAction :: Prelude.Maybe WafOverrideAction,
    -- | The identifier for a rule.
    AwsWafWebAclRule -> Maybe Text
ruleId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the action that CloudFront or WAF takes when a web request
    -- matches the conditions in the rule.
    AwsWafWebAclRule -> Maybe WafAction
action :: Prelude.Maybe WafAction,
    -- | Rules to exclude from a rule group.
    AwsWafWebAclRule -> Maybe [WafExcludedRule]
excludedRules :: Prelude.Maybe [WafExcludedRule],
    -- | The rule type.
    --
    -- Valid values: @REGULAR@ | @RATE_BASED@ | @GROUP@
    --
    -- The default is @REGULAR@.
    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)

-- |
-- Create a value of 'AwsWafWebAclRule' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'priority', 'awsWafWebAclRule_priority' - Specifies the order in which the rules in a WebACL are evaluated. Rules
-- with a lower value for @Priority@ are evaluated before rules with a
-- higher value. The value must be a unique integer. If you add multiple
-- rules to a WebACL, the values do not need to be consecutive.
--
-- 'overrideAction', 'awsWafWebAclRule_overrideAction' - Use the @OverrideAction@ to test your RuleGroup.
--
-- Any rule in a RuleGroup can potentially block a request. If you set the
-- @OverrideAction@ to @None@, the RuleGroup blocks a request if any
-- individual rule in the RuleGroup matches the request and is configured
-- to block that request.
--
-- However, if you first want to test the RuleGroup, set the
-- @OverrideAction@ to @Count@. The RuleGroup then overrides any block
-- action specified by individual rules contained within the group. Instead
-- of blocking matching requests, those requests are counted.
--
-- @ActivatedRule@|@OverrideAction@ applies only when updating or adding a
-- RuleGroup to a WebACL. In this case you do not use
-- @ActivatedRule@|@Action@. For all other update requests,
-- @ActivatedRule@|@Action@ is used instead of
-- @ActivatedRule@|@OverrideAction@.
--
-- 'ruleId', 'awsWafWebAclRule_ruleId' - The identifier for a rule.
--
-- 'action', 'awsWafWebAclRule_action' - Specifies the action that CloudFront or WAF takes when a web request
-- matches the conditions in the rule.
--
-- 'excludedRules', 'awsWafWebAclRule_excludedRules' - Rules to exclude from a rule group.
--
-- 'type'', 'awsWafWebAclRule_type' - The rule type.
--
-- Valid values: @REGULAR@ | @RATE_BASED@ | @GROUP@
--
-- The default is @REGULAR@.
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
    }

-- | Specifies the order in which the rules in a WebACL are evaluated. Rules
-- with a lower value for @Priority@ are evaluated before rules with a
-- higher value. The value must be a unique integer. If you add multiple
-- rules to a WebACL, the values do not need to be consecutive.
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)

-- | Use the @OverrideAction@ to test your RuleGroup.
--
-- Any rule in a RuleGroup can potentially block a request. If you set the
-- @OverrideAction@ to @None@, the RuleGroup blocks a request if any
-- individual rule in the RuleGroup matches the request and is configured
-- to block that request.
--
-- However, if you first want to test the RuleGroup, set the
-- @OverrideAction@ to @Count@. The RuleGroup then overrides any block
-- action specified by individual rules contained within the group. Instead
-- of blocking matching requests, those requests are counted.
--
-- @ActivatedRule@|@OverrideAction@ applies only when updating or adding a
-- RuleGroup to a WebACL. In this case you do not use
-- @ActivatedRule@|@Action@. For all other update requests,
-- @ActivatedRule@|@Action@ is used instead of
-- @ActivatedRule@|@OverrideAction@.
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)

-- | The identifier for a rule.
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)

-- | Specifies the action that CloudFront or WAF takes when a web request
-- matches the conditions in the rule.
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)

-- | Rules to exclude from a rule group.
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

-- | The rule type.
--
-- Valid values: @REGULAR@ | @RATE_BASED@ | @GROUP@
--
-- The default is @REGULAR@.
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'
          ]
      )