{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WAF.Types.SqlInjectionMatchSet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WAF.Types.SqlInjectionMatchSet 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.WAF.Types.SqlInjectionMatchTuple

-- | This is __AWS WAF Classic__ documentation. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html AWS WAF Classic>
-- in the developer guide.
--
-- __For the latest version of AWS WAF__, use the AWS WAFV2 API and see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html AWS WAF Developer Guide>.
-- With the latest version, AWS WAF has a single set of endpoints for
-- regional and global use.
--
-- A complex type that contains @SqlInjectionMatchTuple@ objects, which
-- specify the parts of web requests that you want AWS WAF to inspect for
-- snippets of malicious SQL code and, if you want AWS WAF to inspect a
-- header, the name of the header. If a @SqlInjectionMatchSet@ contains
-- more than one @SqlInjectionMatchTuple@ object, a request needs to
-- include snippets of SQL code in only one of the specified parts of the
-- request to be considered a match.
--
-- /See:/ 'newSqlInjectionMatchSet' smart constructor.
data SqlInjectionMatchSet = SqlInjectionMatchSet'
  { -- | The name, if any, of the @SqlInjectionMatchSet@.
    SqlInjectionMatchSet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for a @SqlInjectionMatchSet@. You use
    -- @SqlInjectionMatchSetId@ to get information about a
    -- @SqlInjectionMatchSet@ (see GetSqlInjectionMatchSet), update a
    -- @SqlInjectionMatchSet@ (see UpdateSqlInjectionMatchSet), insert a
    -- @SqlInjectionMatchSet@ into a @Rule@ or delete one from a @Rule@ (see
    -- UpdateRule), and delete a @SqlInjectionMatchSet@ from AWS WAF (see
    -- DeleteSqlInjectionMatchSet).
    --
    -- @SqlInjectionMatchSetId@ is returned by CreateSqlInjectionMatchSet and
    -- by ListSqlInjectionMatchSets.
    SqlInjectionMatchSet -> Text
sqlInjectionMatchSetId :: Prelude.Text,
    -- | Specifies the parts of web requests that you want to inspect for
    -- snippets of malicious SQL code.
    SqlInjectionMatchSet -> [SqlInjectionMatchTuple]
sqlInjectionMatchTuples :: [SqlInjectionMatchTuple]
  }
  deriving (SqlInjectionMatchSet -> SqlInjectionMatchSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SqlInjectionMatchSet -> SqlInjectionMatchSet -> Bool
$c/= :: SqlInjectionMatchSet -> SqlInjectionMatchSet -> Bool
== :: SqlInjectionMatchSet -> SqlInjectionMatchSet -> Bool
$c== :: SqlInjectionMatchSet -> SqlInjectionMatchSet -> Bool
Prelude.Eq, ReadPrec [SqlInjectionMatchSet]
ReadPrec SqlInjectionMatchSet
Int -> ReadS SqlInjectionMatchSet
ReadS [SqlInjectionMatchSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SqlInjectionMatchSet]
$creadListPrec :: ReadPrec [SqlInjectionMatchSet]
readPrec :: ReadPrec SqlInjectionMatchSet
$creadPrec :: ReadPrec SqlInjectionMatchSet
readList :: ReadS [SqlInjectionMatchSet]
$creadList :: ReadS [SqlInjectionMatchSet]
readsPrec :: Int -> ReadS SqlInjectionMatchSet
$creadsPrec :: Int -> ReadS SqlInjectionMatchSet
Prelude.Read, Int -> SqlInjectionMatchSet -> ShowS
[SqlInjectionMatchSet] -> ShowS
SqlInjectionMatchSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SqlInjectionMatchSet] -> ShowS
$cshowList :: [SqlInjectionMatchSet] -> ShowS
show :: SqlInjectionMatchSet -> String
$cshow :: SqlInjectionMatchSet -> String
showsPrec :: Int -> SqlInjectionMatchSet -> ShowS
$cshowsPrec :: Int -> SqlInjectionMatchSet -> ShowS
Prelude.Show, forall x. Rep SqlInjectionMatchSet x -> SqlInjectionMatchSet
forall x. SqlInjectionMatchSet -> Rep SqlInjectionMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SqlInjectionMatchSet x -> SqlInjectionMatchSet
$cfrom :: forall x. SqlInjectionMatchSet -> Rep SqlInjectionMatchSet x
Prelude.Generic)

-- |
-- Create a value of 'SqlInjectionMatchSet' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'name', 'sqlInjectionMatchSet_name' - The name, if any, of the @SqlInjectionMatchSet@.
--
-- 'sqlInjectionMatchSetId', 'sqlInjectionMatchSet_sqlInjectionMatchSetId' - A unique identifier for a @SqlInjectionMatchSet@. You use
-- @SqlInjectionMatchSetId@ to get information about a
-- @SqlInjectionMatchSet@ (see GetSqlInjectionMatchSet), update a
-- @SqlInjectionMatchSet@ (see UpdateSqlInjectionMatchSet), insert a
-- @SqlInjectionMatchSet@ into a @Rule@ or delete one from a @Rule@ (see
-- UpdateRule), and delete a @SqlInjectionMatchSet@ from AWS WAF (see
-- DeleteSqlInjectionMatchSet).
--
-- @SqlInjectionMatchSetId@ is returned by CreateSqlInjectionMatchSet and
-- by ListSqlInjectionMatchSets.
--
-- 'sqlInjectionMatchTuples', 'sqlInjectionMatchSet_sqlInjectionMatchTuples' - Specifies the parts of web requests that you want to inspect for
-- snippets of malicious SQL code.
newSqlInjectionMatchSet ::
  -- | 'sqlInjectionMatchSetId'
  Prelude.Text ->
  SqlInjectionMatchSet
newSqlInjectionMatchSet :: Text -> SqlInjectionMatchSet
newSqlInjectionMatchSet Text
pSqlInjectionMatchSetId_ =
  SqlInjectionMatchSet'
    { $sel:name:SqlInjectionMatchSet' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:sqlInjectionMatchSetId:SqlInjectionMatchSet' :: Text
sqlInjectionMatchSetId = Text
pSqlInjectionMatchSetId_,
      $sel:sqlInjectionMatchTuples:SqlInjectionMatchSet' :: [SqlInjectionMatchTuple]
sqlInjectionMatchTuples = forall a. Monoid a => a
Prelude.mempty
    }

-- | The name, if any, of the @SqlInjectionMatchSet@.
sqlInjectionMatchSet_name :: Lens.Lens' SqlInjectionMatchSet (Prelude.Maybe Prelude.Text)
sqlInjectionMatchSet_name :: Lens' SqlInjectionMatchSet (Maybe Text)
sqlInjectionMatchSet_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlInjectionMatchSet' {Maybe Text
name :: Maybe Text
$sel:name:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> Maybe Text
name} -> Maybe Text
name) (\s :: SqlInjectionMatchSet
s@SqlInjectionMatchSet' {} Maybe Text
a -> SqlInjectionMatchSet
s {$sel:name:SqlInjectionMatchSet' :: Maybe Text
name = Maybe Text
a} :: SqlInjectionMatchSet)

-- | A unique identifier for a @SqlInjectionMatchSet@. You use
-- @SqlInjectionMatchSetId@ to get information about a
-- @SqlInjectionMatchSet@ (see GetSqlInjectionMatchSet), update a
-- @SqlInjectionMatchSet@ (see UpdateSqlInjectionMatchSet), insert a
-- @SqlInjectionMatchSet@ into a @Rule@ or delete one from a @Rule@ (see
-- UpdateRule), and delete a @SqlInjectionMatchSet@ from AWS WAF (see
-- DeleteSqlInjectionMatchSet).
--
-- @SqlInjectionMatchSetId@ is returned by CreateSqlInjectionMatchSet and
-- by ListSqlInjectionMatchSets.
sqlInjectionMatchSet_sqlInjectionMatchSetId :: Lens.Lens' SqlInjectionMatchSet Prelude.Text
sqlInjectionMatchSet_sqlInjectionMatchSetId :: Lens' SqlInjectionMatchSet Text
sqlInjectionMatchSet_sqlInjectionMatchSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlInjectionMatchSet' {Text
sqlInjectionMatchSetId :: Text
$sel:sqlInjectionMatchSetId:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> Text
sqlInjectionMatchSetId} -> Text
sqlInjectionMatchSetId) (\s :: SqlInjectionMatchSet
s@SqlInjectionMatchSet' {} Text
a -> SqlInjectionMatchSet
s {$sel:sqlInjectionMatchSetId:SqlInjectionMatchSet' :: Text
sqlInjectionMatchSetId = Text
a} :: SqlInjectionMatchSet)

-- | Specifies the parts of web requests that you want to inspect for
-- snippets of malicious SQL code.
sqlInjectionMatchSet_sqlInjectionMatchTuples :: Lens.Lens' SqlInjectionMatchSet [SqlInjectionMatchTuple]
sqlInjectionMatchSet_sqlInjectionMatchTuples :: Lens' SqlInjectionMatchSet [SqlInjectionMatchTuple]
sqlInjectionMatchSet_sqlInjectionMatchTuples = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlInjectionMatchSet' {[SqlInjectionMatchTuple]
sqlInjectionMatchTuples :: [SqlInjectionMatchTuple]
$sel:sqlInjectionMatchTuples:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> [SqlInjectionMatchTuple]
sqlInjectionMatchTuples} -> [SqlInjectionMatchTuple]
sqlInjectionMatchTuples) (\s :: SqlInjectionMatchSet
s@SqlInjectionMatchSet' {} [SqlInjectionMatchTuple]
a -> SqlInjectionMatchSet
s {$sel:sqlInjectionMatchTuples:SqlInjectionMatchSet' :: [SqlInjectionMatchTuple]
sqlInjectionMatchTuples = [SqlInjectionMatchTuple]
a} :: SqlInjectionMatchSet) 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 SqlInjectionMatchSet where
  parseJSON :: Value -> Parser SqlInjectionMatchSet
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SqlInjectionMatchSet"
      ( \Object
x ->
          Maybe Text
-> Text -> [SqlInjectionMatchTuple] -> SqlInjectionMatchSet
SqlInjectionMatchSet'
            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
"Name")
            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
"SqlInjectionMatchSetId")
            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
"SqlInjectionMatchTuples"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable SqlInjectionMatchSet where
  hashWithSalt :: Int -> SqlInjectionMatchSet -> Int
hashWithSalt Int
_salt SqlInjectionMatchSet' {[SqlInjectionMatchTuple]
Maybe Text
Text
sqlInjectionMatchTuples :: [SqlInjectionMatchTuple]
sqlInjectionMatchSetId :: Text
name :: Maybe Text
$sel:sqlInjectionMatchTuples:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> [SqlInjectionMatchTuple]
$sel:sqlInjectionMatchSetId:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> Text
$sel:name:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sqlInjectionMatchSetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [SqlInjectionMatchTuple]
sqlInjectionMatchTuples

instance Prelude.NFData SqlInjectionMatchSet where
  rnf :: SqlInjectionMatchSet -> ()
rnf SqlInjectionMatchSet' {[SqlInjectionMatchTuple]
Maybe Text
Text
sqlInjectionMatchTuples :: [SqlInjectionMatchTuple]
sqlInjectionMatchSetId :: Text
name :: Maybe Text
$sel:sqlInjectionMatchTuples:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> [SqlInjectionMatchTuple]
$sel:sqlInjectionMatchSetId:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> Text
$sel:name:SqlInjectionMatchSet' :: SqlInjectionMatchSet -> Maybe Text
..} =
    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 Text
sqlInjectionMatchSetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [SqlInjectionMatchTuple]
sqlInjectionMatchTuples