{-# 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-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.XssMatchSetUpdate 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.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
(XssMatchSetUpdate -> XssMatchSetUpdate -> Bool)
-> (XssMatchSetUpdate -> XssMatchSetUpdate -> Bool)
-> Eq XssMatchSetUpdate
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]
(Int -> ReadS XssMatchSetUpdate)
-> ReadS [XssMatchSetUpdate]
-> ReadPrec XssMatchSetUpdate
-> ReadPrec [XssMatchSetUpdate]
-> Read 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
(Int -> XssMatchSetUpdate -> ShowS)
-> (XssMatchSetUpdate -> String)
-> ([XssMatchSetUpdate] -> ShowS)
-> Show XssMatchSetUpdate
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. XssMatchSetUpdate -> Rep XssMatchSetUpdate x)
-> (forall x. Rep XssMatchSetUpdate x -> XssMatchSetUpdate)
-> Generic XssMatchSetUpdate
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' :: ChangeAction -> XssMatchTuple -> XssMatchSetUpdate
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 :: (ChangeAction -> f ChangeAction)
-> XssMatchSetUpdate -> f XssMatchSetUpdate
xssMatchSetUpdate_action = (XssMatchSetUpdate -> ChangeAction)
-> (XssMatchSetUpdate -> ChangeAction -> XssMatchSetUpdate)
-> Lens
     XssMatchSetUpdate XssMatchSetUpdate ChangeAction ChangeAction
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 :: (XssMatchTuple -> f XssMatchTuple)
-> XssMatchSetUpdate -> f XssMatchSetUpdate
xssMatchSetUpdate_xssMatchTuple = (XssMatchSetUpdate -> XssMatchTuple)
-> (XssMatchSetUpdate -> XssMatchTuple -> XssMatchSetUpdate)
-> Lens
     XssMatchSetUpdate XssMatchSetUpdate XssMatchTuple 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

instance Prelude.NFData XssMatchSetUpdate

instance Core.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
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
"XssMatchTuple" Text -> XssMatchTuple -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= XssMatchTuple
xssMatchTuple)
          ]
      )