{-# 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.XssMatchStatement 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 XssMatchStatement = XssMatchStatement'
{
XssMatchStatement -> FieldToMatch
fieldToMatch :: FieldToMatch,
XssMatchStatement -> NonEmpty TextTransformation
textTransformations :: Prelude.NonEmpty TextTransformation
}
deriving (XssMatchStatement -> XssMatchStatement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XssMatchStatement -> XssMatchStatement -> Bool
$c/= :: XssMatchStatement -> XssMatchStatement -> Bool
== :: XssMatchStatement -> XssMatchStatement -> Bool
$c== :: XssMatchStatement -> XssMatchStatement -> Bool
Prelude.Eq, ReadPrec [XssMatchStatement]
ReadPrec XssMatchStatement
Int -> ReadS XssMatchStatement
ReadS [XssMatchStatement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [XssMatchStatement]
$creadListPrec :: ReadPrec [XssMatchStatement]
readPrec :: ReadPrec XssMatchStatement
$creadPrec :: ReadPrec XssMatchStatement
readList :: ReadS [XssMatchStatement]
$creadList :: ReadS [XssMatchStatement]
readsPrec :: Int -> ReadS XssMatchStatement
$creadsPrec :: Int -> ReadS XssMatchStatement
Prelude.Read, Int -> XssMatchStatement -> ShowS
[XssMatchStatement] -> ShowS
XssMatchStatement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [XssMatchStatement] -> ShowS
$cshowList :: [XssMatchStatement] -> ShowS
show :: XssMatchStatement -> String
$cshow :: XssMatchStatement -> String
showsPrec :: Int -> XssMatchStatement -> ShowS
$cshowsPrec :: Int -> XssMatchStatement -> ShowS
Prelude.Show, forall x. Rep XssMatchStatement x -> XssMatchStatement
forall x. XssMatchStatement -> Rep XssMatchStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep XssMatchStatement x -> XssMatchStatement
$cfrom :: forall x. XssMatchStatement -> Rep XssMatchStatement x
Prelude.Generic)
newXssMatchStatement ::
FieldToMatch ->
Prelude.NonEmpty TextTransformation ->
XssMatchStatement
newXssMatchStatement :: FieldToMatch -> NonEmpty TextTransformation -> XssMatchStatement
newXssMatchStatement
FieldToMatch
pFieldToMatch_
NonEmpty TextTransformation
pTextTransformations_ =
XssMatchStatement'
{ $sel:fieldToMatch:XssMatchStatement' :: FieldToMatch
fieldToMatch = FieldToMatch
pFieldToMatch_,
$sel:textTransformations:XssMatchStatement' :: 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_
}
xssMatchStatement_fieldToMatch :: Lens.Lens' XssMatchStatement FieldToMatch
xssMatchStatement_fieldToMatch :: Lens' XssMatchStatement FieldToMatch
xssMatchStatement_fieldToMatch = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XssMatchStatement' {FieldToMatch
fieldToMatch :: FieldToMatch
$sel:fieldToMatch:XssMatchStatement' :: XssMatchStatement -> FieldToMatch
fieldToMatch} -> FieldToMatch
fieldToMatch) (\s :: XssMatchStatement
s@XssMatchStatement' {} FieldToMatch
a -> XssMatchStatement
s {$sel:fieldToMatch:XssMatchStatement' :: FieldToMatch
fieldToMatch = FieldToMatch
a} :: XssMatchStatement)
xssMatchStatement_textTransformations :: Lens.Lens' XssMatchStatement (Prelude.NonEmpty TextTransformation)
xssMatchStatement_textTransformations :: Lens' XssMatchStatement (NonEmpty TextTransformation)
xssMatchStatement_textTransformations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XssMatchStatement' {NonEmpty TextTransformation
textTransformations :: NonEmpty TextTransformation
$sel:textTransformations:XssMatchStatement' :: XssMatchStatement -> NonEmpty TextTransformation
textTransformations} -> NonEmpty TextTransformation
textTransformations) (\s :: XssMatchStatement
s@XssMatchStatement' {} NonEmpty TextTransformation
a -> XssMatchStatement
s {$sel:textTransformations:XssMatchStatement' :: NonEmpty TextTransformation
textTransformations = NonEmpty TextTransformation
a} :: XssMatchStatement) 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 XssMatchStatement where
parseJSON :: Value -> Parser XssMatchStatement
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"XssMatchStatement"
( \Object
x ->
FieldToMatch -> NonEmpty TextTransformation -> XssMatchStatement
XssMatchStatement'
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
"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 XssMatchStatement where
hashWithSalt :: Int -> XssMatchStatement -> Int
hashWithSalt Int
_salt XssMatchStatement' {NonEmpty TextTransformation
FieldToMatch
textTransformations :: NonEmpty TextTransformation
fieldToMatch :: FieldToMatch
$sel:textTransformations:XssMatchStatement' :: XssMatchStatement -> NonEmpty TextTransformation
$sel:fieldToMatch:XssMatchStatement' :: XssMatchStatement -> FieldToMatch
..} =
Int
_salt
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 XssMatchStatement where
rnf :: XssMatchStatement -> ()
rnf XssMatchStatement' {NonEmpty TextTransformation
FieldToMatch
textTransformations :: NonEmpty TextTransformation
fieldToMatch :: FieldToMatch
$sel:textTransformations:XssMatchStatement' :: XssMatchStatement -> NonEmpty TextTransformation
$sel:fieldToMatch:XssMatchStatement' :: XssMatchStatement -> FieldToMatch
..} =
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 XssMatchStatement where
toJSON :: XssMatchStatement -> Value
toJSON XssMatchStatement' {NonEmpty TextTransformation
FieldToMatch
textTransformations :: NonEmpty TextTransformation
fieldToMatch :: FieldToMatch
$sel:textTransformations:XssMatchStatement' :: XssMatchStatement -> NonEmpty TextTransformation
$sel:fieldToMatch:XssMatchStatement' :: XssMatchStatement -> FieldToMatch
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ 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)
]
)