{-# 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.WafExcludedRule
-- 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.WafExcludedRule where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about a rule to exclude from a rule group.
--
-- /See:/ 'newWafExcludedRule' smart constructor.
data WafExcludedRule = WafExcludedRule'
  { -- | The unique identifier for the rule to exclude from the rule group.
    WafExcludedRule -> Maybe Text
ruleId :: Prelude.Maybe Prelude.Text
  }
  deriving (WafExcludedRule -> WafExcludedRule -> Bool
(WafExcludedRule -> WafExcludedRule -> Bool)
-> (WafExcludedRule -> WafExcludedRule -> Bool)
-> Eq WafExcludedRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WafExcludedRule -> WafExcludedRule -> Bool
$c/= :: WafExcludedRule -> WafExcludedRule -> Bool
== :: WafExcludedRule -> WafExcludedRule -> Bool
$c== :: WafExcludedRule -> WafExcludedRule -> Bool
Prelude.Eq, ReadPrec [WafExcludedRule]
ReadPrec WafExcludedRule
Int -> ReadS WafExcludedRule
ReadS [WafExcludedRule]
(Int -> ReadS WafExcludedRule)
-> ReadS [WafExcludedRule]
-> ReadPrec WafExcludedRule
-> ReadPrec [WafExcludedRule]
-> Read WafExcludedRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WafExcludedRule]
$creadListPrec :: ReadPrec [WafExcludedRule]
readPrec :: ReadPrec WafExcludedRule
$creadPrec :: ReadPrec WafExcludedRule
readList :: ReadS [WafExcludedRule]
$creadList :: ReadS [WafExcludedRule]
readsPrec :: Int -> ReadS WafExcludedRule
$creadsPrec :: Int -> ReadS WafExcludedRule
Prelude.Read, Int -> WafExcludedRule -> ShowS
[WafExcludedRule] -> ShowS
WafExcludedRule -> String
(Int -> WafExcludedRule -> ShowS)
-> (WafExcludedRule -> String)
-> ([WafExcludedRule] -> ShowS)
-> Show WafExcludedRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WafExcludedRule] -> ShowS
$cshowList :: [WafExcludedRule] -> ShowS
show :: WafExcludedRule -> String
$cshow :: WafExcludedRule -> String
showsPrec :: Int -> WafExcludedRule -> ShowS
$cshowsPrec :: Int -> WafExcludedRule -> ShowS
Prelude.Show, (forall x. WafExcludedRule -> Rep WafExcludedRule x)
-> (forall x. Rep WafExcludedRule x -> WafExcludedRule)
-> Generic WafExcludedRule
forall x. Rep WafExcludedRule x -> WafExcludedRule
forall x. WafExcludedRule -> Rep WafExcludedRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WafExcludedRule x -> WafExcludedRule
$cfrom :: forall x. WafExcludedRule -> Rep WafExcludedRule x
Prelude.Generic)

-- |
-- Create a value of 'WafExcludedRule' 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:
--
-- 'ruleId', 'wafExcludedRule_ruleId' - The unique identifier for the rule to exclude from the rule group.
newWafExcludedRule ::
  WafExcludedRule
newWafExcludedRule :: WafExcludedRule
newWafExcludedRule =
  WafExcludedRule' :: Maybe Text -> WafExcludedRule
WafExcludedRule' {$sel:ruleId:WafExcludedRule' :: Maybe Text
ruleId = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The unique identifier for the rule to exclude from the rule group.
wafExcludedRule_ruleId :: Lens.Lens' WafExcludedRule (Prelude.Maybe Prelude.Text)
wafExcludedRule_ruleId :: (Maybe Text -> f (Maybe Text))
-> WafExcludedRule -> f WafExcludedRule
wafExcludedRule_ruleId = (WafExcludedRule -> Maybe Text)
-> (WafExcludedRule -> Maybe Text -> WafExcludedRule)
-> Lens WafExcludedRule WafExcludedRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WafExcludedRule' {Maybe Text
ruleId :: Maybe Text
$sel:ruleId:WafExcludedRule' :: WafExcludedRule -> Maybe Text
ruleId} -> Maybe Text
ruleId) (\s :: WafExcludedRule
s@WafExcludedRule' {} Maybe Text
a -> WafExcludedRule
s {$sel:ruleId:WafExcludedRule' :: Maybe Text
ruleId = Maybe Text
a} :: WafExcludedRule)

instance Core.FromJSON WafExcludedRule where
  parseJSON :: Value -> Parser WafExcludedRule
parseJSON =
    String
-> (Object -> Parser WafExcludedRule)
-> Value
-> Parser WafExcludedRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WafExcludedRule"
      ( \Object
x ->
          Maybe Text -> WafExcludedRule
WafExcludedRule' (Maybe Text -> WafExcludedRule)
-> Parser (Maybe Text) -> Parser WafExcludedRule
forall (f :: * -> *) a b. Functor 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")
      )

instance Prelude.Hashable WafExcludedRule

instance Prelude.NFData WafExcludedRule

instance Core.ToJSON WafExcludedRule where
  toJSON :: WafExcludedRule -> Value
toJSON WafExcludedRule' {Maybe Text
ruleId :: Maybe Text
$sel:ruleId:WafExcludedRule' :: WafExcludedRule -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(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]
      )