{-# 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.WAFV2.Types.AWSManagedRulesBotControlRuleSet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WAFV2.Types.AWSManagedRulesBotControlRuleSet 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.InspectionLevel

-- | Details for your use of the Bot Control managed rule group, used in
-- @ManagedRuleGroupConfig@.
--
-- /See:/ 'newAWSManagedRulesBotControlRuleSet' smart constructor.
data AWSManagedRulesBotControlRuleSet = AWSManagedRulesBotControlRuleSet'
  { -- | The inspection level to use for the Bot Control rule group. The common
    -- level is the least expensive. The targeted level includes all common
    -- level rules and adds rules with more advanced inspection criteria. For
    -- details, see
    -- <https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-bot.html WAF Bot Control rule group>.
    AWSManagedRulesBotControlRuleSet -> InspectionLevel
inspectionLevel :: InspectionLevel
  }
  deriving (AWSManagedRulesBotControlRuleSet
-> AWSManagedRulesBotControlRuleSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AWSManagedRulesBotControlRuleSet
-> AWSManagedRulesBotControlRuleSet -> Bool
$c/= :: AWSManagedRulesBotControlRuleSet
-> AWSManagedRulesBotControlRuleSet -> Bool
== :: AWSManagedRulesBotControlRuleSet
-> AWSManagedRulesBotControlRuleSet -> Bool
$c== :: AWSManagedRulesBotControlRuleSet
-> AWSManagedRulesBotControlRuleSet -> Bool
Prelude.Eq, ReadPrec [AWSManagedRulesBotControlRuleSet]
ReadPrec AWSManagedRulesBotControlRuleSet
Int -> ReadS AWSManagedRulesBotControlRuleSet
ReadS [AWSManagedRulesBotControlRuleSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AWSManagedRulesBotControlRuleSet]
$creadListPrec :: ReadPrec [AWSManagedRulesBotControlRuleSet]
readPrec :: ReadPrec AWSManagedRulesBotControlRuleSet
$creadPrec :: ReadPrec AWSManagedRulesBotControlRuleSet
readList :: ReadS [AWSManagedRulesBotControlRuleSet]
$creadList :: ReadS [AWSManagedRulesBotControlRuleSet]
readsPrec :: Int -> ReadS AWSManagedRulesBotControlRuleSet
$creadsPrec :: Int -> ReadS AWSManagedRulesBotControlRuleSet
Prelude.Read, Int -> AWSManagedRulesBotControlRuleSet -> ShowS
[AWSManagedRulesBotControlRuleSet] -> ShowS
AWSManagedRulesBotControlRuleSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AWSManagedRulesBotControlRuleSet] -> ShowS
$cshowList :: [AWSManagedRulesBotControlRuleSet] -> ShowS
show :: AWSManagedRulesBotControlRuleSet -> String
$cshow :: AWSManagedRulesBotControlRuleSet -> String
showsPrec :: Int -> AWSManagedRulesBotControlRuleSet -> ShowS
$cshowsPrec :: Int -> AWSManagedRulesBotControlRuleSet -> ShowS
Prelude.Show, forall x.
Rep AWSManagedRulesBotControlRuleSet x
-> AWSManagedRulesBotControlRuleSet
forall x.
AWSManagedRulesBotControlRuleSet
-> Rep AWSManagedRulesBotControlRuleSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AWSManagedRulesBotControlRuleSet x
-> AWSManagedRulesBotControlRuleSet
$cfrom :: forall x.
AWSManagedRulesBotControlRuleSet
-> Rep AWSManagedRulesBotControlRuleSet x
Prelude.Generic)

-- |
-- Create a value of 'AWSManagedRulesBotControlRuleSet' 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:
--
-- 'inspectionLevel', 'aWSManagedRulesBotControlRuleSet_inspectionLevel' - The inspection level to use for the Bot Control rule group. The common
-- level is the least expensive. The targeted level includes all common
-- level rules and adds rules with more advanced inspection criteria. For
-- details, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-bot.html WAF Bot Control rule group>.
newAWSManagedRulesBotControlRuleSet ::
  -- | 'inspectionLevel'
  InspectionLevel ->
  AWSManagedRulesBotControlRuleSet
newAWSManagedRulesBotControlRuleSet :: InspectionLevel -> AWSManagedRulesBotControlRuleSet
newAWSManagedRulesBotControlRuleSet InspectionLevel
pInspectionLevel_ =
  AWSManagedRulesBotControlRuleSet'
    { $sel:inspectionLevel:AWSManagedRulesBotControlRuleSet' :: InspectionLevel
inspectionLevel =
        InspectionLevel
pInspectionLevel_
    }

-- | The inspection level to use for the Bot Control rule group. The common
-- level is the least expensive. The targeted level includes all common
-- level rules and adds rules with more advanced inspection criteria. For
-- details, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-bot.html WAF Bot Control rule group>.
aWSManagedRulesBotControlRuleSet_inspectionLevel :: Lens.Lens' AWSManagedRulesBotControlRuleSet InspectionLevel
aWSManagedRulesBotControlRuleSet_inspectionLevel :: Lens' AWSManagedRulesBotControlRuleSet InspectionLevel
aWSManagedRulesBotControlRuleSet_inspectionLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AWSManagedRulesBotControlRuleSet' {InspectionLevel
inspectionLevel :: InspectionLevel
$sel:inspectionLevel:AWSManagedRulesBotControlRuleSet' :: AWSManagedRulesBotControlRuleSet -> InspectionLevel
inspectionLevel} -> InspectionLevel
inspectionLevel) (\s :: AWSManagedRulesBotControlRuleSet
s@AWSManagedRulesBotControlRuleSet' {} InspectionLevel
a -> AWSManagedRulesBotControlRuleSet
s {$sel:inspectionLevel:AWSManagedRulesBotControlRuleSet' :: InspectionLevel
inspectionLevel = InspectionLevel
a} :: AWSManagedRulesBotControlRuleSet)

instance
  Data.FromJSON
    AWSManagedRulesBotControlRuleSet
  where
  parseJSON :: Value -> Parser AWSManagedRulesBotControlRuleSet
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AWSManagedRulesBotControlRuleSet"
      ( \Object
x ->
          InspectionLevel -> AWSManagedRulesBotControlRuleSet
AWSManagedRulesBotControlRuleSet'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"InspectionLevel")
      )

instance
  Prelude.Hashable
    AWSManagedRulesBotControlRuleSet
  where
  hashWithSalt :: Int -> AWSManagedRulesBotControlRuleSet -> Int
hashWithSalt
    Int
_salt
    AWSManagedRulesBotControlRuleSet' {InspectionLevel
inspectionLevel :: InspectionLevel
$sel:inspectionLevel:AWSManagedRulesBotControlRuleSet' :: AWSManagedRulesBotControlRuleSet -> InspectionLevel
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InspectionLevel
inspectionLevel

instance
  Prelude.NFData
    AWSManagedRulesBotControlRuleSet
  where
  rnf :: AWSManagedRulesBotControlRuleSet -> ()
rnf AWSManagedRulesBotControlRuleSet' {InspectionLevel
inspectionLevel :: InspectionLevel
$sel:inspectionLevel:AWSManagedRulesBotControlRuleSet' :: AWSManagedRulesBotControlRuleSet -> InspectionLevel
..} =
    forall a. NFData a => a -> ()
Prelude.rnf InspectionLevel
inspectionLevel

instance Data.ToJSON AWSManagedRulesBotControlRuleSet where
  toJSON :: AWSManagedRulesBotControlRuleSet -> Value
toJSON AWSManagedRulesBotControlRuleSet' {InspectionLevel
inspectionLevel :: InspectionLevel
$sel:inspectionLevel:AWSManagedRulesBotControlRuleSet' :: AWSManagedRulesBotControlRuleSet -> InspectionLevel
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"InspectionLevel" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= InspectionLevel
inspectionLevel)
          ]
      )