{-# 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.WAFRegional.Types.RuleGroup 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
data RuleGroup = RuleGroup'
{
RuleGroup -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
RuleGroup -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
RuleGroup -> Text
ruleGroupId :: Prelude.Text
}
deriving (RuleGroup -> RuleGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RuleGroup -> RuleGroup -> Bool
$c/= :: RuleGroup -> RuleGroup -> Bool
== :: RuleGroup -> RuleGroup -> Bool
$c== :: RuleGroup -> RuleGroup -> Bool
Prelude.Eq, ReadPrec [RuleGroup]
ReadPrec RuleGroup
Int -> ReadS RuleGroup
ReadS [RuleGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RuleGroup]
$creadListPrec :: ReadPrec [RuleGroup]
readPrec :: ReadPrec RuleGroup
$creadPrec :: ReadPrec RuleGroup
readList :: ReadS [RuleGroup]
$creadList :: ReadS [RuleGroup]
readsPrec :: Int -> ReadS RuleGroup
$creadsPrec :: Int -> ReadS RuleGroup
Prelude.Read, Int -> RuleGroup -> ShowS
[RuleGroup] -> ShowS
RuleGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuleGroup] -> ShowS
$cshowList :: [RuleGroup] -> ShowS
show :: RuleGroup -> String
$cshow :: RuleGroup -> String
showsPrec :: Int -> RuleGroup -> ShowS
$cshowsPrec :: Int -> RuleGroup -> ShowS
Prelude.Show, forall x. Rep RuleGroup x -> RuleGroup
forall x. RuleGroup -> Rep RuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RuleGroup x -> RuleGroup
$cfrom :: forall x. RuleGroup -> Rep RuleGroup x
Prelude.Generic)
newRuleGroup ::
Prelude.Text ->
RuleGroup
newRuleGroup :: Text -> RuleGroup
newRuleGroup Text
pRuleGroupId_ =
RuleGroup'
{ $sel:metricName:RuleGroup' :: Maybe Text
metricName = forall a. Maybe a
Prelude.Nothing,
$sel:name:RuleGroup' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:ruleGroupId:RuleGroup' :: Text
ruleGroupId = Text
pRuleGroupId_
}
ruleGroup_metricName :: Lens.Lens' RuleGroup (Prelude.Maybe Prelude.Text)
ruleGroup_metricName :: Lens' RuleGroup (Maybe Text)
ruleGroup_metricName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroup' {Maybe Text
metricName :: Maybe Text
$sel:metricName:RuleGroup' :: RuleGroup -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: RuleGroup
s@RuleGroup' {} Maybe Text
a -> RuleGroup
s {$sel:metricName:RuleGroup' :: Maybe Text
metricName = Maybe Text
a} :: RuleGroup)
ruleGroup_name :: Lens.Lens' RuleGroup (Prelude.Maybe Prelude.Text)
ruleGroup_name :: Lens' RuleGroup (Maybe Text)
ruleGroup_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroup' {Maybe Text
name :: Maybe Text
$sel:name:RuleGroup' :: RuleGroup -> Maybe Text
name} -> Maybe Text
name) (\s :: RuleGroup
s@RuleGroup' {} Maybe Text
a -> RuleGroup
s {$sel:name:RuleGroup' :: Maybe Text
name = Maybe Text
a} :: RuleGroup)
ruleGroup_ruleGroupId :: Lens.Lens' RuleGroup Prelude.Text
ruleGroup_ruleGroupId :: Lens' RuleGroup Text
ruleGroup_ruleGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroup' {Text
ruleGroupId :: Text
$sel:ruleGroupId:RuleGroup' :: RuleGroup -> Text
ruleGroupId} -> Text
ruleGroupId) (\s :: RuleGroup
s@RuleGroup' {} Text
a -> RuleGroup
s {$sel:ruleGroupId:RuleGroup' :: Text
ruleGroupId = Text
a} :: RuleGroup)
instance Data.FromJSON RuleGroup where
parseJSON :: Value -> Parser RuleGroup
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RuleGroup"
( \Object
x ->
Maybe Text -> Maybe Text -> Text -> RuleGroup
RuleGroup'
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
"MetricName")
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
"Name")
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
"RuleGroupId")
)
instance Prelude.Hashable RuleGroup where
hashWithSalt :: Int -> RuleGroup -> Int
hashWithSalt Int
_salt RuleGroup' {Maybe Text
Text
ruleGroupId :: Text
name :: Maybe Text
metricName :: Maybe Text
$sel:ruleGroupId:RuleGroup' :: RuleGroup -> Text
$sel:name:RuleGroup' :: RuleGroup -> Maybe Text
$sel:metricName:RuleGroup' :: RuleGroup -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metricName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleGroupId
instance Prelude.NFData RuleGroup where
rnf :: RuleGroup -> ()
rnf RuleGroup' {Maybe Text
Text
ruleGroupId :: Text
name :: Maybe Text
metricName :: Maybe Text
$sel:ruleGroupId:RuleGroup' :: RuleGroup -> Text
$sel:name:RuleGroup' :: RuleGroup -> Maybe Text
$sel:metricName:RuleGroup' :: RuleGroup -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metricName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ruleGroupId