{-# 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.Lens as Lens
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
(RuleGroup -> RuleGroup -> Bool)
-> (RuleGroup -> RuleGroup -> Bool) -> Eq RuleGroup
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]
(Int -> ReadS RuleGroup)
-> ReadS [RuleGroup]
-> ReadPrec RuleGroup
-> ReadPrec [RuleGroup]
-> Read 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
(Int -> RuleGroup -> ShowS)
-> (RuleGroup -> String)
-> ([RuleGroup] -> ShowS)
-> Show RuleGroup
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. RuleGroup -> Rep RuleGroup x)
-> (forall x. Rep RuleGroup x -> RuleGroup) -> Generic RuleGroup
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' :: Maybe Text -> Maybe Text -> Text -> RuleGroup
RuleGroup'
{ $sel:metricName:RuleGroup' :: Maybe Text
metricName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:RuleGroup' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ruleGroupId:RuleGroup' :: Text
ruleGroupId = Text
pRuleGroupId_
}
ruleGroup_metricName :: Lens.Lens' RuleGroup (Prelude.Maybe Prelude.Text)
ruleGroup_metricName :: (Maybe Text -> f (Maybe Text)) -> RuleGroup -> f RuleGroup
ruleGroup_metricName = (RuleGroup -> Maybe Text)
-> (RuleGroup -> Maybe Text -> RuleGroup)
-> Lens RuleGroup RuleGroup (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> RuleGroup -> f RuleGroup
ruleGroup_name = (RuleGroup -> Maybe Text)
-> (RuleGroup -> Maybe Text -> RuleGroup)
-> Lens RuleGroup RuleGroup (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> RuleGroup -> f RuleGroup
ruleGroup_ruleGroupId = (RuleGroup -> Text)
-> (RuleGroup -> Text -> RuleGroup)
-> Lens RuleGroup RuleGroup Text Text
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 Core.FromJSON RuleGroup where
parseJSON :: Value -> Parser RuleGroup
parseJSON =
String -> (Object -> Parser RuleGroup) -> Value -> Parser RuleGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RuleGroup"
( \Object
x ->
Maybe Text -> Maybe Text -> Text -> RuleGroup
RuleGroup'
(Maybe Text -> Maybe Text -> Text -> RuleGroup)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Text -> RuleGroup)
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
"MetricName")
Parser (Maybe Text -> Text -> RuleGroup)
-> Parser (Maybe Text) -> Parser (Text -> RuleGroup)
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
"Name")
Parser (Text -> RuleGroup) -> Parser Text -> Parser RuleGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RuleGroupId")
)
instance Prelude.Hashable RuleGroup
instance Prelude.NFData RuleGroup