{-# 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.XssMatchSetUpdate
-- 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.WAFRegional.Types.XssMatchSetUpdate 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.WAFRegional.Types.ChangeAction
import Amazonka.WAFRegional.Types.XssMatchTuple

-- | 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
-- cross-site scripting attacks and indicates whether you want to add the
-- specification to an XssMatchSet or delete it from an @XssMatchSet@.
--
-- /See:/ 'newXssMatchSetUpdate' smart constructor.
data XssMatchSetUpdate = XssMatchSetUpdate'
  { -- | Specify @INSERT@ to add an XssMatchSetUpdate to an XssMatchSet. Use
    -- @DELETE@ to remove an @XssMatchSetUpdate@ from an @XssMatchSet@.
    XssMatchSetUpdate -> ChangeAction
action :: ChangeAction,
    -- | Specifies the part of a web request that you want AWS WAF to inspect for
    -- cross-site scripting attacks and, if you want AWS WAF to inspect a
    -- header, the name of the header.
    XssMatchSetUpdate -> XssMatchTuple
xssMatchTuple :: XssMatchTuple
  }
  deriving (XssMatchSetUpdate -> XssMatchSetUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XssMatchSetUpdate -> XssMatchSetUpdate -> Bool
$c/= :: XssMatchSetUpdate -> XssMatchSetUpdate -> Bool
== :: XssMatchSetUpdate -> XssMatchSetUpdate -> Bool
$c== :: XssMatchSetUpdate -> XssMatchSetUpdate -> Bool
Prelude.Eq, ReadPrec [XssMatchSetUpdate]
ReadPrec XssMatchSetUpdate
Int -> ReadS XssMatchSetUpdate
ReadS [XssMatchSetUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [XssMatchSetUpdate]
$creadListPrec :: ReadPrec [XssMatchSetUpdate]
readPrec :: ReadPrec XssMatchSetUpdate
$creadPrec :: ReadPrec XssMatchSetUpdate
readList :: ReadS [XssMatchSetUpdate]
$creadList :: ReadS [XssMatchSetUpdate]
readsPrec :: Int -> ReadS XssMatchSetUpdate
$creadsPrec :: Int -> ReadS XssMatchSetUpdate
Prelude.Read, Int -> XssMatchSetUpdate -> ShowS
[XssMatchSetUpdate] -> ShowS
XssMatchSetUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [XssMatchSetUpdate] -> ShowS
$cshowList :: [XssMatchSetUpdate] -> ShowS
show :: XssMatchSetUpdate -> String
$cshow :: XssMatchSetUpdate -> String
showsPrec :: Int -> XssMatchSetUpdate -> ShowS
$cshowsPrec :: Int -> XssMatchSetUpdate -> ShowS
Prelude.Show, forall x. Rep XssMatchSetUpdate x -> XssMatchSetUpdate
forall x. XssMatchSetUpdate -> Rep XssMatchSetUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep XssMatchSetUpdate x -> XssMatchSetUpdate
$cfrom :: forall x. XssMatchSetUpdate -> Rep XssMatchSetUpdate x
Prelude.Generic)

-- |
-- Create a value of 'XssMatchSetUpdate' 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', 'xssMatchSetUpdate_action' - Specify @INSERT@ to add an XssMatchSetUpdate to an XssMatchSet. Use
-- @DELETE@ to remove an @XssMatchSetUpdate@ from an @XssMatchSet@.
--
-- 'xssMatchTuple', 'xssMatchSetUpdate_xssMatchTuple' - Specifies the part of a web request that you want AWS WAF to inspect for
-- cross-site scripting attacks and, if you want AWS WAF to inspect a
-- header, the name of the header.
newXssMatchSetUpdate ::
  -- | 'action'
  ChangeAction ->
  -- | 'xssMatchTuple'
  XssMatchTuple ->
  XssMatchSetUpdate
newXssMatchSetUpdate :: ChangeAction -> XssMatchTuple -> XssMatchSetUpdate
newXssMatchSetUpdate ChangeAction
pAction_ XssMatchTuple
pXssMatchTuple_ =
  XssMatchSetUpdate'
    { $sel:action:XssMatchSetUpdate' :: ChangeAction
action = ChangeAction
pAction_,
      $sel:xssMatchTuple:XssMatchSetUpdate' :: XssMatchTuple
xssMatchTuple = XssMatchTuple
pXssMatchTuple_
    }

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

-- | Specifies the part of a web request that you want AWS WAF to inspect for
-- cross-site scripting attacks and, if you want AWS WAF to inspect a
-- header, the name of the header.
xssMatchSetUpdate_xssMatchTuple :: Lens.Lens' XssMatchSetUpdate XssMatchTuple
xssMatchSetUpdate_xssMatchTuple :: Lens' XssMatchSetUpdate XssMatchTuple
xssMatchSetUpdate_xssMatchTuple = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XssMatchSetUpdate' {XssMatchTuple
xssMatchTuple :: XssMatchTuple
$sel:xssMatchTuple:XssMatchSetUpdate' :: XssMatchSetUpdate -> XssMatchTuple
xssMatchTuple} -> XssMatchTuple
xssMatchTuple) (\s :: XssMatchSetUpdate
s@XssMatchSetUpdate' {} XssMatchTuple
a -> XssMatchSetUpdate
s {$sel:xssMatchTuple:XssMatchSetUpdate' :: XssMatchTuple
xssMatchTuple = XssMatchTuple
a} :: XssMatchSetUpdate)

instance Prelude.Hashable XssMatchSetUpdate where
  hashWithSalt :: Int -> XssMatchSetUpdate -> Int
hashWithSalt Int
_salt XssMatchSetUpdate' {ChangeAction
XssMatchTuple
xssMatchTuple :: XssMatchTuple
action :: ChangeAction
$sel:xssMatchTuple:XssMatchSetUpdate' :: XssMatchSetUpdate -> XssMatchTuple
$sel:action:XssMatchSetUpdate' :: XssMatchSetUpdate -> ChangeAction
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ChangeAction
action
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` XssMatchTuple
xssMatchTuple

instance Prelude.NFData XssMatchSetUpdate where
  rnf :: XssMatchSetUpdate -> ()
rnf XssMatchSetUpdate' {ChangeAction
XssMatchTuple
xssMatchTuple :: XssMatchTuple
action :: ChangeAction
$sel:xssMatchTuple:XssMatchSetUpdate' :: XssMatchSetUpdate -> XssMatchTuple
$sel:action:XssMatchSetUpdate' :: XssMatchSetUpdate -> ChangeAction
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ChangeAction
action
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf XssMatchTuple
xssMatchTuple

instance Data.ToJSON XssMatchSetUpdate where
  toJSON :: XssMatchSetUpdate -> Value
toJSON XssMatchSetUpdate' {ChangeAction
XssMatchTuple
xssMatchTuple :: XssMatchTuple
action :: ChangeAction
$sel:xssMatchTuple:XssMatchSetUpdate' :: XssMatchSetUpdate -> XssMatchTuple
$sel:action:XssMatchSetUpdate' :: XssMatchSetUpdate -> ChangeAction
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Action" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ChangeAction
action),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"XssMatchTuple" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= XssMatchTuple
xssMatchTuple)
          ]
      )