{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:metricName:WebACL' :: Maybe Text
metricName = forall a. Maybe a
Prelude.Nothing,
$sel:name:WebACL' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:webACLArn:WebACL' :: Maybe Text
webACLArn = 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 = forall a. Monoid a => a
Prelude.mempty
}
webACL_metricName :: Lens.Lens' WebACL (Prelude.Maybe Prelude.Text)
webACL_metricName :: Lens' WebACL (Maybe Text)
webACL_metricName = 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 :: Lens' WebACL (Maybe Text)
webACL_name = 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 :: Lens' WebACL (Maybe Text)
webACL_webACLArn = 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 :: Lens' WebACL Text
webACL_webACLId = 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 :: Lens' WebACL WafAction
webACL_defaultAction = 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 :: Lens' WebACL [ActivatedRule]
webACL_rules = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON WebACL where
parseJSON :: Value -> Parser WebACL
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"WebACL"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> WafAction
-> [ActivatedRule]
-> WebACL
WebACL'
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 (Maybe a)
Data..:? Key
"WebACLArn")
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
"WebACLId")
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
"DefaultAction")
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
"Rules" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable WebACL where
hashWithSalt :: Int -> WebACL -> Int
hashWithSalt Int
_salt WebACL' {[ActivatedRule]
Maybe Text
Text
WafAction
rules :: [ActivatedRule]
defaultAction :: WafAction
webACLId :: Text
webACLArn :: Maybe Text
name :: Maybe Text
metricName :: Maybe Text
$sel:rules:WebACL' :: WebACL -> [ActivatedRule]
$sel:defaultAction:WebACL' :: WebACL -> WafAction
$sel:webACLId:WebACL' :: WebACL -> Text
$sel:webACLArn:WebACL' :: WebACL -> Maybe Text
$sel:name:WebACL' :: WebACL -> Maybe Text
$sel:metricName:WebACL' :: WebACL -> 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` Maybe Text
webACLArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
webACLId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WafAction
defaultAction
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ActivatedRule]
rules
instance Prelude.NFData WebACL where
rnf :: WebACL -> ()
rnf WebACL' {[ActivatedRule]
Maybe Text
Text
WafAction
rules :: [ActivatedRule]
defaultAction :: WafAction
webACLId :: Text
webACLArn :: Maybe Text
name :: Maybe Text
metricName :: Maybe Text
$sel:rules:WebACL' :: WebACL -> [ActivatedRule]
$sel:defaultAction:WebACL' :: WebACL -> WafAction
$sel:webACLId:WebACL' :: WebACL -> Text
$sel:webACLArn:WebACL' :: WebACL -> Maybe Text
$sel:name:WebACL' :: WebACL -> Maybe Text
$sel:metricName:WebACL' :: WebACL -> 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 Maybe Text
webACLArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
webACLId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WafAction
defaultAction
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ActivatedRule]
rules