{-# 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.WAFV2.Types.RegexMatchStatement 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.FieldToMatch
import Amazonka.WAFV2.Types.TextTransformation
data RegexMatchStatement = RegexMatchStatement'
{
RegexMatchStatement -> Text
regexString :: Prelude.Text,
RegexMatchStatement -> FieldToMatch
fieldToMatch :: FieldToMatch,
RegexMatchStatement -> NonEmpty TextTransformation
textTransformations :: Prelude.NonEmpty TextTransformation
}
deriving (RegexMatchStatement -> RegexMatchStatement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegexMatchStatement -> RegexMatchStatement -> Bool
$c/= :: RegexMatchStatement -> RegexMatchStatement -> Bool
== :: RegexMatchStatement -> RegexMatchStatement -> Bool
$c== :: RegexMatchStatement -> RegexMatchStatement -> Bool
Prelude.Eq, ReadPrec [RegexMatchStatement]
ReadPrec RegexMatchStatement
Int -> ReadS RegexMatchStatement
ReadS [RegexMatchStatement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegexMatchStatement]
$creadListPrec :: ReadPrec [RegexMatchStatement]
readPrec :: ReadPrec RegexMatchStatement
$creadPrec :: ReadPrec RegexMatchStatement
readList :: ReadS [RegexMatchStatement]
$creadList :: ReadS [RegexMatchStatement]
readsPrec :: Int -> ReadS RegexMatchStatement
$creadsPrec :: Int -> ReadS RegexMatchStatement
Prelude.Read, Int -> RegexMatchStatement -> ShowS
[RegexMatchStatement] -> ShowS
RegexMatchStatement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegexMatchStatement] -> ShowS
$cshowList :: [RegexMatchStatement] -> ShowS
show :: RegexMatchStatement -> String
$cshow :: RegexMatchStatement -> String
showsPrec :: Int -> RegexMatchStatement -> ShowS
$cshowsPrec :: Int -> RegexMatchStatement -> ShowS
Prelude.Show, forall x. Rep RegexMatchStatement x -> RegexMatchStatement
forall x. RegexMatchStatement -> Rep RegexMatchStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegexMatchStatement x -> RegexMatchStatement
$cfrom :: forall x. RegexMatchStatement -> Rep RegexMatchStatement x
Prelude.Generic)
newRegexMatchStatement ::
Prelude.Text ->
FieldToMatch ->
Prelude.NonEmpty TextTransformation ->
RegexMatchStatement
newRegexMatchStatement :: Text
-> FieldToMatch
-> NonEmpty TextTransformation
-> RegexMatchStatement
newRegexMatchStatement
Text
pRegexString_
FieldToMatch
pFieldToMatch_
NonEmpty TextTransformation
pTextTransformations_ =
RegexMatchStatement'
{ $sel:regexString:RegexMatchStatement' :: Text
regexString = Text
pRegexString_,
$sel:fieldToMatch:RegexMatchStatement' :: FieldToMatch
fieldToMatch = FieldToMatch
pFieldToMatch_,
$sel:textTransformations:RegexMatchStatement' :: NonEmpty TextTransformation
textTransformations =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty TextTransformation
pTextTransformations_
}
regexMatchStatement_regexString :: Lens.Lens' RegexMatchStatement Prelude.Text
regexMatchStatement_regexString :: Lens' RegexMatchStatement Text
regexMatchStatement_regexString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegexMatchStatement' {Text
regexString :: Text
$sel:regexString:RegexMatchStatement' :: RegexMatchStatement -> Text
regexString} -> Text
regexString) (\s :: RegexMatchStatement
s@RegexMatchStatement' {} Text
a -> RegexMatchStatement
s {$sel:regexString:RegexMatchStatement' :: Text
regexString = Text
a} :: RegexMatchStatement)
regexMatchStatement_fieldToMatch :: Lens.Lens' RegexMatchStatement FieldToMatch
regexMatchStatement_fieldToMatch :: Lens' RegexMatchStatement FieldToMatch
regexMatchStatement_fieldToMatch = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegexMatchStatement' {FieldToMatch
fieldToMatch :: FieldToMatch
$sel:fieldToMatch:RegexMatchStatement' :: RegexMatchStatement -> FieldToMatch
fieldToMatch} -> FieldToMatch
fieldToMatch) (\s :: RegexMatchStatement
s@RegexMatchStatement' {} FieldToMatch
a -> RegexMatchStatement
s {$sel:fieldToMatch:RegexMatchStatement' :: FieldToMatch
fieldToMatch = FieldToMatch
a} :: RegexMatchStatement)
regexMatchStatement_textTransformations :: Lens.Lens' RegexMatchStatement (Prelude.NonEmpty TextTransformation)
regexMatchStatement_textTransformations :: Lens' RegexMatchStatement (NonEmpty TextTransformation)
regexMatchStatement_textTransformations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegexMatchStatement' {NonEmpty TextTransformation
textTransformations :: NonEmpty TextTransformation
$sel:textTransformations:RegexMatchStatement' :: RegexMatchStatement -> NonEmpty TextTransformation
textTransformations} -> NonEmpty TextTransformation
textTransformations) (\s :: RegexMatchStatement
s@RegexMatchStatement' {} NonEmpty TextTransformation
a -> RegexMatchStatement
s {$sel:textTransformations:RegexMatchStatement' :: NonEmpty TextTransformation
textTransformations = NonEmpty TextTransformation
a} :: RegexMatchStatement) 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 RegexMatchStatement where
parseJSON :: Value -> Parser RegexMatchStatement
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"RegexMatchStatement"
( \Object
x ->
Text
-> FieldToMatch
-> NonEmpty TextTransformation
-> RegexMatchStatement
RegexMatchStatement'
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
"RegexString")
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
"FieldToMatch")
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
"TextTransformations")
)
instance Prelude.Hashable RegexMatchStatement where
hashWithSalt :: Int -> RegexMatchStatement -> Int
hashWithSalt Int
_salt RegexMatchStatement' {NonEmpty TextTransformation
Text
FieldToMatch
textTransformations :: NonEmpty TextTransformation
fieldToMatch :: FieldToMatch
regexString :: Text
$sel:textTransformations:RegexMatchStatement' :: RegexMatchStatement -> NonEmpty TextTransformation
$sel:fieldToMatch:RegexMatchStatement' :: RegexMatchStatement -> FieldToMatch
$sel:regexString:RegexMatchStatement' :: RegexMatchStatement -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
regexString
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FieldToMatch
fieldToMatch
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty TextTransformation
textTransformations
instance Prelude.NFData RegexMatchStatement where
rnf :: RegexMatchStatement -> ()
rnf RegexMatchStatement' {NonEmpty TextTransformation
Text
FieldToMatch
textTransformations :: NonEmpty TextTransformation
fieldToMatch :: FieldToMatch
regexString :: Text
$sel:textTransformations:RegexMatchStatement' :: RegexMatchStatement -> NonEmpty TextTransformation
$sel:fieldToMatch:RegexMatchStatement' :: RegexMatchStatement -> FieldToMatch
$sel:regexString:RegexMatchStatement' :: RegexMatchStatement -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
regexString
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FieldToMatch
fieldToMatch
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty TextTransformation
textTransformations
instance Data.ToJSON RegexMatchStatement where
toJSON :: RegexMatchStatement -> Value
toJSON RegexMatchStatement' {NonEmpty TextTransformation
Text
FieldToMatch
textTransformations :: NonEmpty TextTransformation
fieldToMatch :: FieldToMatch
regexString :: Text
$sel:textTransformations:RegexMatchStatement' :: RegexMatchStatement -> NonEmpty TextTransformation
$sel:fieldToMatch:RegexMatchStatement' :: RegexMatchStatement -> FieldToMatch
$sel:regexString:RegexMatchStatement' :: RegexMatchStatement -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"RegexString" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
regexString),
forall a. a -> Maybe a
Prelude.Just (Key
"FieldToMatch" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FieldToMatch
fieldToMatch),
forall a. a -> Maybe a
Prelude.Just
(Key
"TextTransformations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty TextTransformation
textTransformations)
]
)