{-# 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.SqlInjectionMatchSetUpdate
-- 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.SqlInjectionMatchSetUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFRegional.Types.ChangeAction
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.
--
-- Specifies the part of a web request that you want to inspect for
-- snippets of malicious SQL code and indicates whether you want to add the
-- specification to a SqlInjectionMatchSet or delete it from a
-- @SqlInjectionMatchSet@.
--
-- /See:/ 'newSqlInjectionMatchSetUpdate' smart constructor.
data SqlInjectionMatchSetUpdate = SqlInjectionMatchSetUpdate'
  { -- | Specify @INSERT@ to add a SqlInjectionMatchSetUpdate to a
    -- SqlInjectionMatchSet. Use @DELETE@ to remove a
    -- @SqlInjectionMatchSetUpdate@ from a @SqlInjectionMatchSet@.
    SqlInjectionMatchSetUpdate -> ChangeAction
action :: ChangeAction,
    -- | Specifies the part of a web request 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.
    SqlInjectionMatchSetUpdate -> SqlInjectionMatchTuple
sqlInjectionMatchTuple :: SqlInjectionMatchTuple
  }
  deriving (SqlInjectionMatchSetUpdate -> SqlInjectionMatchSetUpdate -> Bool
(SqlInjectionMatchSetUpdate -> SqlInjectionMatchSetUpdate -> Bool)
-> (SqlInjectionMatchSetUpdate
    -> SqlInjectionMatchSetUpdate -> Bool)
-> Eq SqlInjectionMatchSetUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SqlInjectionMatchSetUpdate -> SqlInjectionMatchSetUpdate -> Bool
$c/= :: SqlInjectionMatchSetUpdate -> SqlInjectionMatchSetUpdate -> Bool
== :: SqlInjectionMatchSetUpdate -> SqlInjectionMatchSetUpdate -> Bool
$c== :: SqlInjectionMatchSetUpdate -> SqlInjectionMatchSetUpdate -> Bool
Prelude.Eq, ReadPrec [SqlInjectionMatchSetUpdate]
ReadPrec SqlInjectionMatchSetUpdate
Int -> ReadS SqlInjectionMatchSetUpdate
ReadS [SqlInjectionMatchSetUpdate]
(Int -> ReadS SqlInjectionMatchSetUpdate)
-> ReadS [SqlInjectionMatchSetUpdate]
-> ReadPrec SqlInjectionMatchSetUpdate
-> ReadPrec [SqlInjectionMatchSetUpdate]
-> Read SqlInjectionMatchSetUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SqlInjectionMatchSetUpdate]
$creadListPrec :: ReadPrec [SqlInjectionMatchSetUpdate]
readPrec :: ReadPrec SqlInjectionMatchSetUpdate
$creadPrec :: ReadPrec SqlInjectionMatchSetUpdate
readList :: ReadS [SqlInjectionMatchSetUpdate]
$creadList :: ReadS [SqlInjectionMatchSetUpdate]
readsPrec :: Int -> ReadS SqlInjectionMatchSetUpdate
$creadsPrec :: Int -> ReadS SqlInjectionMatchSetUpdate
Prelude.Read, Int -> SqlInjectionMatchSetUpdate -> ShowS
[SqlInjectionMatchSetUpdate] -> ShowS
SqlInjectionMatchSetUpdate -> String
(Int -> SqlInjectionMatchSetUpdate -> ShowS)
-> (SqlInjectionMatchSetUpdate -> String)
-> ([SqlInjectionMatchSetUpdate] -> ShowS)
-> Show SqlInjectionMatchSetUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SqlInjectionMatchSetUpdate] -> ShowS
$cshowList :: [SqlInjectionMatchSetUpdate] -> ShowS
show :: SqlInjectionMatchSetUpdate -> String
$cshow :: SqlInjectionMatchSetUpdate -> String
showsPrec :: Int -> SqlInjectionMatchSetUpdate -> ShowS
$cshowsPrec :: Int -> SqlInjectionMatchSetUpdate -> ShowS
Prelude.Show, (forall x.
 SqlInjectionMatchSetUpdate -> Rep SqlInjectionMatchSetUpdate x)
-> (forall x.
    Rep SqlInjectionMatchSetUpdate x -> SqlInjectionMatchSetUpdate)
-> Generic SqlInjectionMatchSetUpdate
forall x.
Rep SqlInjectionMatchSetUpdate x -> SqlInjectionMatchSetUpdate
forall x.
SqlInjectionMatchSetUpdate -> Rep SqlInjectionMatchSetUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SqlInjectionMatchSetUpdate x -> SqlInjectionMatchSetUpdate
$cfrom :: forall x.
SqlInjectionMatchSetUpdate -> Rep SqlInjectionMatchSetUpdate x
Prelude.Generic)

-- |
-- Create a value of 'SqlInjectionMatchSetUpdate' 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:
--
-- 'action', 'sqlInjectionMatchSetUpdate_action' - Specify @INSERT@ to add a SqlInjectionMatchSetUpdate to a
-- SqlInjectionMatchSet. Use @DELETE@ to remove a
-- @SqlInjectionMatchSetUpdate@ from a @SqlInjectionMatchSet@.
--
-- 'sqlInjectionMatchTuple', 'sqlInjectionMatchSetUpdate_sqlInjectionMatchTuple' - Specifies the part of a web request 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.
newSqlInjectionMatchSetUpdate ::
  -- | 'action'
  ChangeAction ->
  -- | 'sqlInjectionMatchTuple'
  SqlInjectionMatchTuple ->
  SqlInjectionMatchSetUpdate
newSqlInjectionMatchSetUpdate :: ChangeAction
-> SqlInjectionMatchTuple -> SqlInjectionMatchSetUpdate
newSqlInjectionMatchSetUpdate
  ChangeAction
pAction_
  SqlInjectionMatchTuple
pSqlInjectionMatchTuple_ =
    SqlInjectionMatchSetUpdate' :: ChangeAction
-> SqlInjectionMatchTuple -> SqlInjectionMatchSetUpdate
SqlInjectionMatchSetUpdate'
      { $sel:action:SqlInjectionMatchSetUpdate' :: ChangeAction
action = ChangeAction
pAction_,
        $sel:sqlInjectionMatchTuple:SqlInjectionMatchSetUpdate' :: SqlInjectionMatchTuple
sqlInjectionMatchTuple =
          SqlInjectionMatchTuple
pSqlInjectionMatchTuple_
      }

-- | Specify @INSERT@ to add a SqlInjectionMatchSetUpdate to a
-- SqlInjectionMatchSet. Use @DELETE@ to remove a
-- @SqlInjectionMatchSetUpdate@ from a @SqlInjectionMatchSet@.
sqlInjectionMatchSetUpdate_action :: Lens.Lens' SqlInjectionMatchSetUpdate ChangeAction
sqlInjectionMatchSetUpdate_action :: (ChangeAction -> f ChangeAction)
-> SqlInjectionMatchSetUpdate -> f SqlInjectionMatchSetUpdate
sqlInjectionMatchSetUpdate_action = (SqlInjectionMatchSetUpdate -> ChangeAction)
-> (SqlInjectionMatchSetUpdate
    -> ChangeAction -> SqlInjectionMatchSetUpdate)
-> Lens
     SqlInjectionMatchSetUpdate
     SqlInjectionMatchSetUpdate
     ChangeAction
     ChangeAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlInjectionMatchSetUpdate' {ChangeAction
action :: ChangeAction
$sel:action:SqlInjectionMatchSetUpdate' :: SqlInjectionMatchSetUpdate -> ChangeAction
action} -> ChangeAction
action) (\s :: SqlInjectionMatchSetUpdate
s@SqlInjectionMatchSetUpdate' {} ChangeAction
a -> SqlInjectionMatchSetUpdate
s {$sel:action:SqlInjectionMatchSetUpdate' :: ChangeAction
action = ChangeAction
a} :: SqlInjectionMatchSetUpdate)

-- | Specifies the part of a web request 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.
sqlInjectionMatchSetUpdate_sqlInjectionMatchTuple :: Lens.Lens' SqlInjectionMatchSetUpdate SqlInjectionMatchTuple
sqlInjectionMatchSetUpdate_sqlInjectionMatchTuple :: (SqlInjectionMatchTuple -> f SqlInjectionMatchTuple)
-> SqlInjectionMatchSetUpdate -> f SqlInjectionMatchSetUpdate
sqlInjectionMatchSetUpdate_sqlInjectionMatchTuple = (SqlInjectionMatchSetUpdate -> SqlInjectionMatchTuple)
-> (SqlInjectionMatchSetUpdate
    -> SqlInjectionMatchTuple -> SqlInjectionMatchSetUpdate)
-> Lens
     SqlInjectionMatchSetUpdate
     SqlInjectionMatchSetUpdate
     SqlInjectionMatchTuple
     SqlInjectionMatchTuple
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlInjectionMatchSetUpdate' {SqlInjectionMatchTuple
sqlInjectionMatchTuple :: SqlInjectionMatchTuple
$sel:sqlInjectionMatchTuple:SqlInjectionMatchSetUpdate' :: SqlInjectionMatchSetUpdate -> SqlInjectionMatchTuple
sqlInjectionMatchTuple} -> SqlInjectionMatchTuple
sqlInjectionMatchTuple) (\s :: SqlInjectionMatchSetUpdate
s@SqlInjectionMatchSetUpdate' {} SqlInjectionMatchTuple
a -> SqlInjectionMatchSetUpdate
s {$sel:sqlInjectionMatchTuple:SqlInjectionMatchSetUpdate' :: SqlInjectionMatchTuple
sqlInjectionMatchTuple = SqlInjectionMatchTuple
a} :: SqlInjectionMatchSetUpdate)

instance Prelude.Hashable SqlInjectionMatchSetUpdate

instance Prelude.NFData SqlInjectionMatchSetUpdate

instance Core.ToJSON SqlInjectionMatchSetUpdate where
  toJSON :: SqlInjectionMatchSetUpdate -> Value
toJSON SqlInjectionMatchSetUpdate' {ChangeAction
SqlInjectionMatchTuple
sqlInjectionMatchTuple :: SqlInjectionMatchTuple
action :: ChangeAction
$sel:sqlInjectionMatchTuple:SqlInjectionMatchSetUpdate' :: SqlInjectionMatchSetUpdate -> SqlInjectionMatchTuple
$sel:action:SqlInjectionMatchSetUpdate' :: SqlInjectionMatchSetUpdate -> ChangeAction
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Action" Text -> ChangeAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChangeAction
action),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"SqlInjectionMatchTuple"
                  Text -> SqlInjectionMatchTuple -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SqlInjectionMatchTuple
sqlInjectionMatchTuple
              )
          ]
      )