{-# 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.WAFRegional.Types.SqlInjectionMatchSet
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WAFRegional.Types.SqlInjectionMatchSet where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFRegional.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
(SqlInjectionMatchSet -> SqlInjectionMatchSet -> Bool)
-> (SqlInjectionMatchSet -> SqlInjectionMatchSet -> Bool)
-> Eq SqlInjectionMatchSet
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]
(Int -> ReadS SqlInjectionMatchSet)
-> ReadS [SqlInjectionMatchSet]
-> ReadPrec SqlInjectionMatchSet
-> ReadPrec [SqlInjectionMatchSet]
-> Read 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
(Int -> SqlInjectionMatchSet -> ShowS)
-> (SqlInjectionMatchSet -> String)
-> ([SqlInjectionMatchSet] -> ShowS)
-> Show SqlInjectionMatchSet
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. SqlInjectionMatchSet -> Rep SqlInjectionMatchSet x)
-> (forall x. Rep SqlInjectionMatchSet x -> SqlInjectionMatchSet)
-> Generic SqlInjectionMatchSet
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' :: Maybe Text
-> Text -> [SqlInjectionMatchTuple] -> SqlInjectionMatchSet
SqlInjectionMatchSet'
    { $sel:name:SqlInjectionMatchSet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sqlInjectionMatchSetId:SqlInjectionMatchSet' :: Text
sqlInjectionMatchSetId = Text
pSqlInjectionMatchSetId_,
      $sel:sqlInjectionMatchTuples:SqlInjectionMatchSet' :: [SqlInjectionMatchTuple]
sqlInjectionMatchTuples = [SqlInjectionMatchTuple]
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 :: (Maybe Text -> f (Maybe Text))
-> SqlInjectionMatchSet -> f SqlInjectionMatchSet
sqlInjectionMatchSet_name = (SqlInjectionMatchSet -> Maybe Text)
-> (SqlInjectionMatchSet -> Maybe Text -> SqlInjectionMatchSet)
-> Lens
     SqlInjectionMatchSet SqlInjectionMatchSet (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> SqlInjectionMatchSet -> f SqlInjectionMatchSet
sqlInjectionMatchSet_sqlInjectionMatchSetId = (SqlInjectionMatchSet -> Text)
-> (SqlInjectionMatchSet -> Text -> SqlInjectionMatchSet)
-> Lens SqlInjectionMatchSet SqlInjectionMatchSet Text Text
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 :: ([SqlInjectionMatchTuple] -> f [SqlInjectionMatchTuple])
-> SqlInjectionMatchSet -> f SqlInjectionMatchSet
sqlInjectionMatchSet_sqlInjectionMatchTuples = (SqlInjectionMatchSet -> [SqlInjectionMatchTuple])
-> (SqlInjectionMatchSet
    -> [SqlInjectionMatchTuple] -> SqlInjectionMatchSet)
-> Lens
     SqlInjectionMatchSet
     SqlInjectionMatchSet
     [SqlInjectionMatchTuple]
     [SqlInjectionMatchTuple]
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) (([SqlInjectionMatchTuple] -> f [SqlInjectionMatchTuple])
 -> SqlInjectionMatchSet -> f SqlInjectionMatchSet)
-> (([SqlInjectionMatchTuple] -> f [SqlInjectionMatchTuple])
    -> [SqlInjectionMatchTuple] -> f [SqlInjectionMatchTuple])
-> ([SqlInjectionMatchTuple] -> f [SqlInjectionMatchTuple])
-> SqlInjectionMatchSet
-> f SqlInjectionMatchSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SqlInjectionMatchTuple] -> f [SqlInjectionMatchTuple])
-> [SqlInjectionMatchTuple] -> f [SqlInjectionMatchTuple]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON SqlInjectionMatchSet where
  parseJSON :: Value -> Parser SqlInjectionMatchSet
parseJSON =
    String
-> (Object -> Parser SqlInjectionMatchSet)
-> Value
-> Parser SqlInjectionMatchSet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SqlInjectionMatchSet"
      ( \Object
x ->
          Maybe Text
-> Text -> [SqlInjectionMatchTuple] -> SqlInjectionMatchSet
SqlInjectionMatchSet'
            (Maybe Text
 -> Text -> [SqlInjectionMatchTuple] -> SqlInjectionMatchSet)
-> Parser (Maybe Text)
-> Parser
     (Text -> [SqlInjectionMatchTuple] -> SqlInjectionMatchSet)
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
"Name")
            Parser (Text -> [SqlInjectionMatchTuple] -> SqlInjectionMatchSet)
-> Parser Text
-> Parser ([SqlInjectionMatchTuple] -> SqlInjectionMatchSet)
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
"SqlInjectionMatchSetId")
            Parser ([SqlInjectionMatchTuple] -> SqlInjectionMatchSet)
-> Parser [SqlInjectionMatchTuple] -> Parser SqlInjectionMatchSet
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [SqlInjectionMatchTuple])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SqlInjectionMatchTuples"
                            Parser (Maybe [SqlInjectionMatchTuple])
-> [SqlInjectionMatchTuple] -> Parser [SqlInjectionMatchTuple]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [SqlInjectionMatchTuple]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable SqlInjectionMatchSet

instance Prelude.NFData SqlInjectionMatchSet