{-# 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.WebACL where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFRegional.Types.ActivatedRule
import Amazonka.WAFRegional.Types.WafAction
data WebACL = WebACL'
{
WebACL -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
WebACL -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
WebACL -> Maybe Text
webACLArn :: Prelude.Maybe Prelude.Text,
WebACL -> Text
webACLId :: Prelude.Text,
WebACL -> WafAction
defaultAction :: WafAction,
WebACL -> [ActivatedRule]
rules :: [ActivatedRule]
}
deriving (WebACL -> WebACL -> Bool
(WebACL -> WebACL -> Bool)
-> (WebACL -> WebACL -> Bool) -> Eq WebACL
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WebACL -> WebACL -> Bool
$c/= :: WebACL -> WebACL -> Bool
== :: WebACL -> WebACL -> Bool
$c== :: WebACL -> WebACL -> Bool
Prelude.Eq, ReadPrec [WebACL]
ReadPrec WebACL
Int -> ReadS WebACL
ReadS [WebACL]
(Int -> ReadS WebACL)
-> ReadS [WebACL]
-> ReadPrec WebACL
-> ReadPrec [WebACL]
-> Read WebACL
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WebACL]
$creadListPrec :: ReadPrec [WebACL]
readPrec :: ReadPrec WebACL
$creadPrec :: ReadPrec WebACL
readList :: ReadS [WebACL]
$creadList :: ReadS [WebACL]
readsPrec :: Int -> ReadS WebACL
$creadsPrec :: Int -> ReadS WebACL
Prelude.Read, Int -> WebACL -> ShowS
[WebACL] -> ShowS
WebACL -> String
(Int -> WebACL -> ShowS)
-> (WebACL -> String) -> ([WebACL] -> ShowS) -> Show WebACL
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WebACL] -> ShowS
$cshowList :: [WebACL] -> ShowS
show :: WebACL -> String
$cshow :: WebACL -> String
showsPrec :: Int -> WebACL -> ShowS
$cshowsPrec :: Int -> WebACL -> ShowS
Prelude.Show, (forall x. WebACL -> Rep WebACL x)
-> (forall x. Rep WebACL x -> WebACL) -> Generic WebACL
forall x. Rep WebACL x -> WebACL
forall x. WebACL -> Rep WebACL x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WebACL x -> WebACL
$cfrom :: forall x. WebACL -> Rep WebACL x
Prelude.Generic)
newWebACL ::
Prelude.Text ->
WafAction ->
WebACL
newWebACL :: Text -> WafAction -> WebACL
newWebACL Text
pWebACLId_ WafAction
pDefaultAction_ =
WebACL' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> WafAction
-> [ActivatedRule]
-> WebACL
WebACL'
{ $sel:metricName:WebACL' :: Maybe Text
metricName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:WebACL' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:webACLArn:WebACL' :: Maybe Text
webACLArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:webACLId:WebACL' :: Text
webACLId = Text
pWebACLId_,
$sel:defaultAction:WebACL' :: WafAction
defaultAction = WafAction
pDefaultAction_,
$sel:rules:WebACL' :: [ActivatedRule]
rules = [ActivatedRule]
forall a. Monoid a => a
Prelude.mempty
}
webACL_metricName :: Lens.Lens' WebACL (Prelude.Maybe Prelude.Text)
webACL_metricName :: (Maybe Text -> f (Maybe Text)) -> WebACL -> f WebACL
webACL_metricName = (WebACL -> Maybe Text)
-> (WebACL -> Maybe Text -> WebACL)
-> Lens WebACL WebACL (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebACL' {Maybe Text
metricName :: Maybe Text
$sel:metricName:WebACL' :: WebACL -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: WebACL
s@WebACL' {} Maybe Text
a -> WebACL
s {$sel:metricName:WebACL' :: Maybe Text
metricName = Maybe Text
a} :: WebACL)
webACL_name :: Lens.Lens' WebACL (Prelude.Maybe Prelude.Text)
webACL_name :: (Maybe Text -> f (Maybe Text)) -> WebACL -> f WebACL
webACL_name = (WebACL -> Maybe Text)
-> (WebACL -> Maybe Text -> WebACL)
-> Lens WebACL WebACL (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebACL' {Maybe Text
name :: Maybe Text
$sel:name:WebACL' :: WebACL -> Maybe Text
name} -> Maybe Text
name) (\s :: WebACL
s@WebACL' {} Maybe Text
a -> WebACL
s {$sel:name:WebACL' :: Maybe Text
name = Maybe Text
a} :: WebACL)
webACL_webACLArn :: Lens.Lens' WebACL (Prelude.Maybe Prelude.Text)
webACL_webACLArn :: (Maybe Text -> f (Maybe Text)) -> WebACL -> f WebACL
webACL_webACLArn = (WebACL -> Maybe Text)
-> (WebACL -> Maybe Text -> WebACL)
-> Lens WebACL WebACL (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebACL' {Maybe Text
webACLArn :: Maybe Text
$sel:webACLArn:WebACL' :: WebACL -> Maybe Text
webACLArn} -> Maybe Text
webACLArn) (\s :: WebACL
s@WebACL' {} Maybe Text
a -> WebACL
s {$sel:webACLArn:WebACL' :: Maybe Text
webACLArn = Maybe Text
a} :: WebACL)
webACL_webACLId :: Lens.Lens' WebACL Prelude.Text
webACL_webACLId :: (Text -> f Text) -> WebACL -> f WebACL
webACL_webACLId = (WebACL -> Text)
-> (WebACL -> Text -> WebACL) -> Lens WebACL WebACL Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebACL' {Text
webACLId :: Text
$sel:webACLId:WebACL' :: WebACL -> Text
webACLId} -> Text
webACLId) (\s :: WebACL
s@WebACL' {} Text
a -> WebACL
s {$sel:webACLId:WebACL' :: Text
webACLId = Text
a} :: WebACL)
webACL_defaultAction :: Lens.Lens' WebACL WafAction
webACL_defaultAction :: (WafAction -> f WafAction) -> WebACL -> f WebACL
webACL_defaultAction = (WebACL -> WafAction)
-> (WebACL -> WafAction -> WebACL)
-> Lens WebACL WebACL WafAction WafAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebACL' {WafAction
defaultAction :: WafAction
$sel:defaultAction:WebACL' :: WebACL -> WafAction
defaultAction} -> WafAction
defaultAction) (\s :: WebACL
s@WebACL' {} WafAction
a -> WebACL
s {$sel:defaultAction:WebACL' :: WafAction
defaultAction = WafAction
a} :: WebACL)
webACL_rules :: Lens.Lens' WebACL [ActivatedRule]
webACL_rules :: ([ActivatedRule] -> f [ActivatedRule]) -> WebACL -> f WebACL
webACL_rules = (WebACL -> [ActivatedRule])
-> (WebACL -> [ActivatedRule] -> WebACL)
-> Lens WebACL WebACL [ActivatedRule] [ActivatedRule]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebACL' {[ActivatedRule]
rules :: [ActivatedRule]
$sel:rules:WebACL' :: WebACL -> [ActivatedRule]
rules} -> [ActivatedRule]
rules) (\s :: WebACL
s@WebACL' {} [ActivatedRule]
a -> WebACL
s {$sel:rules:WebACL' :: [ActivatedRule]
rules = [ActivatedRule]
a} :: WebACL) (([ActivatedRule] -> f [ActivatedRule]) -> WebACL -> f WebACL)
-> (([ActivatedRule] -> f [ActivatedRule])
-> [ActivatedRule] -> f [ActivatedRule])
-> ([ActivatedRule] -> f [ActivatedRule])
-> WebACL
-> f WebACL
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ActivatedRule] -> f [ActivatedRule])
-> [ActivatedRule] -> f [ActivatedRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON WebACL where
parseJSON :: Value -> Parser WebACL
parseJSON =
String -> (Object -> Parser WebACL) -> Value -> Parser WebACL
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"WebACL"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> WafAction
-> [ActivatedRule]
-> WebACL
WebACL'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> WafAction
-> [ActivatedRule]
-> WebACL)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> Text -> WafAction -> [ActivatedRule] -> WebACL)
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
-> Maybe Text -> Text -> WafAction -> [ActivatedRule] -> WebACL)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Text -> WafAction -> [ActivatedRule] -> WebACL)
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
(Maybe Text -> Text -> WafAction -> [ActivatedRule] -> WebACL)
-> Parser (Maybe Text)
-> Parser (Text -> WafAction -> [ActivatedRule] -> WebACL)
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
"WebACLArn")
Parser (Text -> WafAction -> [ActivatedRule] -> WebACL)
-> Parser Text -> Parser (WafAction -> [ActivatedRule] -> WebACL)
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
"WebACLId")
Parser (WafAction -> [ActivatedRule] -> WebACL)
-> Parser WafAction -> Parser ([ActivatedRule] -> WebACL)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WafAction
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DefaultAction")
Parser ([ActivatedRule] -> WebACL)
-> Parser [ActivatedRule] -> Parser WebACL
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [ActivatedRule])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Rules" Parser (Maybe [ActivatedRule])
-> [ActivatedRule] -> Parser [ActivatedRule]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ActivatedRule]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable WebACL
instance Prelude.NFData WebACL