{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.WAFRegional.UpdateXssMatchSet
(
UpdateXssMatchSet (..),
newUpdateXssMatchSet,
updateXssMatchSet_xssMatchSetId,
updateXssMatchSet_changeToken,
updateXssMatchSet_updates,
UpdateXssMatchSetResponse (..),
newUpdateXssMatchSetResponse,
updateXssMatchSetResponse_changeToken,
updateXssMatchSetResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAFRegional.Types
data UpdateXssMatchSet = UpdateXssMatchSet'
{
UpdateXssMatchSet -> Text
xssMatchSetId :: Prelude.Text,
UpdateXssMatchSet -> Text
changeToken :: Prelude.Text,
UpdateXssMatchSet -> NonEmpty XssMatchSetUpdate
updates :: Prelude.NonEmpty XssMatchSetUpdate
}
deriving (UpdateXssMatchSet -> UpdateXssMatchSet -> Bool
(UpdateXssMatchSet -> UpdateXssMatchSet -> Bool)
-> (UpdateXssMatchSet -> UpdateXssMatchSet -> Bool)
-> Eq UpdateXssMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateXssMatchSet -> UpdateXssMatchSet -> Bool
$c/= :: UpdateXssMatchSet -> UpdateXssMatchSet -> Bool
== :: UpdateXssMatchSet -> UpdateXssMatchSet -> Bool
$c== :: UpdateXssMatchSet -> UpdateXssMatchSet -> Bool
Prelude.Eq, ReadPrec [UpdateXssMatchSet]
ReadPrec UpdateXssMatchSet
Int -> ReadS UpdateXssMatchSet
ReadS [UpdateXssMatchSet]
(Int -> ReadS UpdateXssMatchSet)
-> ReadS [UpdateXssMatchSet]
-> ReadPrec UpdateXssMatchSet
-> ReadPrec [UpdateXssMatchSet]
-> Read UpdateXssMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateXssMatchSet]
$creadListPrec :: ReadPrec [UpdateXssMatchSet]
readPrec :: ReadPrec UpdateXssMatchSet
$creadPrec :: ReadPrec UpdateXssMatchSet
readList :: ReadS [UpdateXssMatchSet]
$creadList :: ReadS [UpdateXssMatchSet]
readsPrec :: Int -> ReadS UpdateXssMatchSet
$creadsPrec :: Int -> ReadS UpdateXssMatchSet
Prelude.Read, Int -> UpdateXssMatchSet -> ShowS
[UpdateXssMatchSet] -> ShowS
UpdateXssMatchSet -> String
(Int -> UpdateXssMatchSet -> ShowS)
-> (UpdateXssMatchSet -> String)
-> ([UpdateXssMatchSet] -> ShowS)
-> Show UpdateXssMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateXssMatchSet] -> ShowS
$cshowList :: [UpdateXssMatchSet] -> ShowS
show :: UpdateXssMatchSet -> String
$cshow :: UpdateXssMatchSet -> String
showsPrec :: Int -> UpdateXssMatchSet -> ShowS
$cshowsPrec :: Int -> UpdateXssMatchSet -> ShowS
Prelude.Show, (forall x. UpdateXssMatchSet -> Rep UpdateXssMatchSet x)
-> (forall x. Rep UpdateXssMatchSet x -> UpdateXssMatchSet)
-> Generic UpdateXssMatchSet
forall x. Rep UpdateXssMatchSet x -> UpdateXssMatchSet
forall x. UpdateXssMatchSet -> Rep UpdateXssMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateXssMatchSet x -> UpdateXssMatchSet
$cfrom :: forall x. UpdateXssMatchSet -> Rep UpdateXssMatchSet x
Prelude.Generic)
newUpdateXssMatchSet ::
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty XssMatchSetUpdate ->
UpdateXssMatchSet
newUpdateXssMatchSet :: Text -> Text -> NonEmpty XssMatchSetUpdate -> UpdateXssMatchSet
newUpdateXssMatchSet
Text
pXssMatchSetId_
Text
pChangeToken_
NonEmpty XssMatchSetUpdate
pUpdates_ =
UpdateXssMatchSet' :: Text -> Text -> NonEmpty XssMatchSetUpdate -> UpdateXssMatchSet
UpdateXssMatchSet'
{ $sel:xssMatchSetId:UpdateXssMatchSet' :: Text
xssMatchSetId = Text
pXssMatchSetId_,
$sel:changeToken:UpdateXssMatchSet' :: Text
changeToken = Text
pChangeToken_,
$sel:updates:UpdateXssMatchSet' :: NonEmpty XssMatchSetUpdate
updates = Tagged
(NonEmpty XssMatchSetUpdate)
(Identity (NonEmpty XssMatchSetUpdate))
-> Tagged
(NonEmpty XssMatchSetUpdate)
(Identity (NonEmpty XssMatchSetUpdate))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty XssMatchSetUpdate)
(Identity (NonEmpty XssMatchSetUpdate))
-> Tagged
(NonEmpty XssMatchSetUpdate)
(Identity (NonEmpty XssMatchSetUpdate)))
-> NonEmpty XssMatchSetUpdate -> NonEmpty XssMatchSetUpdate
forall t b. AReview t b -> b -> t
Lens.# NonEmpty XssMatchSetUpdate
pUpdates_
}
updateXssMatchSet_xssMatchSetId :: Lens.Lens' UpdateXssMatchSet Prelude.Text
updateXssMatchSet_xssMatchSetId :: (Text -> f Text) -> UpdateXssMatchSet -> f UpdateXssMatchSet
updateXssMatchSet_xssMatchSetId = (UpdateXssMatchSet -> Text)
-> (UpdateXssMatchSet -> Text -> UpdateXssMatchSet)
-> Lens UpdateXssMatchSet UpdateXssMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateXssMatchSet' {Text
xssMatchSetId :: Text
$sel:xssMatchSetId:UpdateXssMatchSet' :: UpdateXssMatchSet -> Text
xssMatchSetId} -> Text
xssMatchSetId) (\s :: UpdateXssMatchSet
s@UpdateXssMatchSet' {} Text
a -> UpdateXssMatchSet
s {$sel:xssMatchSetId:UpdateXssMatchSet' :: Text
xssMatchSetId = Text
a} :: UpdateXssMatchSet)
updateXssMatchSet_changeToken :: Lens.Lens' UpdateXssMatchSet Prelude.Text
updateXssMatchSet_changeToken :: (Text -> f Text) -> UpdateXssMatchSet -> f UpdateXssMatchSet
updateXssMatchSet_changeToken = (UpdateXssMatchSet -> Text)
-> (UpdateXssMatchSet -> Text -> UpdateXssMatchSet)
-> Lens UpdateXssMatchSet UpdateXssMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateXssMatchSet' {Text
changeToken :: Text
$sel:changeToken:UpdateXssMatchSet' :: UpdateXssMatchSet -> Text
changeToken} -> Text
changeToken) (\s :: UpdateXssMatchSet
s@UpdateXssMatchSet' {} Text
a -> UpdateXssMatchSet
s {$sel:changeToken:UpdateXssMatchSet' :: Text
changeToken = Text
a} :: UpdateXssMatchSet)
updateXssMatchSet_updates :: Lens.Lens' UpdateXssMatchSet (Prelude.NonEmpty XssMatchSetUpdate)
updateXssMatchSet_updates :: (NonEmpty XssMatchSetUpdate -> f (NonEmpty XssMatchSetUpdate))
-> UpdateXssMatchSet -> f UpdateXssMatchSet
updateXssMatchSet_updates = (UpdateXssMatchSet -> NonEmpty XssMatchSetUpdate)
-> (UpdateXssMatchSet
-> NonEmpty XssMatchSetUpdate -> UpdateXssMatchSet)
-> Lens
UpdateXssMatchSet
UpdateXssMatchSet
(NonEmpty XssMatchSetUpdate)
(NonEmpty XssMatchSetUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateXssMatchSet' {NonEmpty XssMatchSetUpdate
updates :: NonEmpty XssMatchSetUpdate
$sel:updates:UpdateXssMatchSet' :: UpdateXssMatchSet -> NonEmpty XssMatchSetUpdate
updates} -> NonEmpty XssMatchSetUpdate
updates) (\s :: UpdateXssMatchSet
s@UpdateXssMatchSet' {} NonEmpty XssMatchSetUpdate
a -> UpdateXssMatchSet
s {$sel:updates:UpdateXssMatchSet' :: NonEmpty XssMatchSetUpdate
updates = NonEmpty XssMatchSetUpdate
a} :: UpdateXssMatchSet) ((NonEmpty XssMatchSetUpdate -> f (NonEmpty XssMatchSetUpdate))
-> UpdateXssMatchSet -> f UpdateXssMatchSet)
-> ((NonEmpty XssMatchSetUpdate -> f (NonEmpty XssMatchSetUpdate))
-> NonEmpty XssMatchSetUpdate -> f (NonEmpty XssMatchSetUpdate))
-> (NonEmpty XssMatchSetUpdate -> f (NonEmpty XssMatchSetUpdate))
-> UpdateXssMatchSet
-> f UpdateXssMatchSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty XssMatchSetUpdate -> f (NonEmpty XssMatchSetUpdate))
-> NonEmpty XssMatchSetUpdate -> f (NonEmpty XssMatchSetUpdate)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest UpdateXssMatchSet where
type
AWSResponse UpdateXssMatchSet =
UpdateXssMatchSetResponse
request :: UpdateXssMatchSet -> Request UpdateXssMatchSet
request = Service -> UpdateXssMatchSet -> Request UpdateXssMatchSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateXssMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateXssMatchSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateXssMatchSet))
-> Logger
-> Service
-> Proxy UpdateXssMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateXssMatchSet)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> UpdateXssMatchSetResponse
UpdateXssMatchSetResponse'
(Maybe Text -> Int -> UpdateXssMatchSetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateXssMatchSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChangeToken")
Either String (Int -> UpdateXssMatchSetResponse)
-> Either String Int -> Either String UpdateXssMatchSetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateXssMatchSet
instance Prelude.NFData UpdateXssMatchSet
instance Core.ToHeaders UpdateXssMatchSet where
toHeaders :: UpdateXssMatchSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateXssMatchSet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSWAF_Regional_20161128.UpdateXssMatchSet" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateXssMatchSet where
toJSON :: UpdateXssMatchSet -> Value
toJSON UpdateXssMatchSet' {NonEmpty XssMatchSetUpdate
Text
updates :: NonEmpty XssMatchSetUpdate
changeToken :: Text
xssMatchSetId :: Text
$sel:updates:UpdateXssMatchSet' :: UpdateXssMatchSet -> NonEmpty XssMatchSetUpdate
$sel:changeToken:UpdateXssMatchSet' :: UpdateXssMatchSet -> Text
$sel:xssMatchSetId:UpdateXssMatchSet' :: UpdateXssMatchSet -> Text
..} =
[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
"XssMatchSetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
xssMatchSetId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ChangeToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
changeToken),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Updates" Text -> NonEmpty XssMatchSetUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty XssMatchSetUpdate
updates)
]
)
instance Core.ToPath UpdateXssMatchSet where
toPath :: UpdateXssMatchSet -> ByteString
toPath = ByteString -> UpdateXssMatchSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateXssMatchSet where
toQuery :: UpdateXssMatchSet -> QueryString
toQuery = QueryString -> UpdateXssMatchSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateXssMatchSetResponse = UpdateXssMatchSetResponse'
{
UpdateXssMatchSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
UpdateXssMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateXssMatchSetResponse -> UpdateXssMatchSetResponse -> Bool
(UpdateXssMatchSetResponse -> UpdateXssMatchSetResponse -> Bool)
-> (UpdateXssMatchSetResponse -> UpdateXssMatchSetResponse -> Bool)
-> Eq UpdateXssMatchSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateXssMatchSetResponse -> UpdateXssMatchSetResponse -> Bool
$c/= :: UpdateXssMatchSetResponse -> UpdateXssMatchSetResponse -> Bool
== :: UpdateXssMatchSetResponse -> UpdateXssMatchSetResponse -> Bool
$c== :: UpdateXssMatchSetResponse -> UpdateXssMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [UpdateXssMatchSetResponse]
ReadPrec UpdateXssMatchSetResponse
Int -> ReadS UpdateXssMatchSetResponse
ReadS [UpdateXssMatchSetResponse]
(Int -> ReadS UpdateXssMatchSetResponse)
-> ReadS [UpdateXssMatchSetResponse]
-> ReadPrec UpdateXssMatchSetResponse
-> ReadPrec [UpdateXssMatchSetResponse]
-> Read UpdateXssMatchSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateXssMatchSetResponse]
$creadListPrec :: ReadPrec [UpdateXssMatchSetResponse]
readPrec :: ReadPrec UpdateXssMatchSetResponse
$creadPrec :: ReadPrec UpdateXssMatchSetResponse
readList :: ReadS [UpdateXssMatchSetResponse]
$creadList :: ReadS [UpdateXssMatchSetResponse]
readsPrec :: Int -> ReadS UpdateXssMatchSetResponse
$creadsPrec :: Int -> ReadS UpdateXssMatchSetResponse
Prelude.Read, Int -> UpdateXssMatchSetResponse -> ShowS
[UpdateXssMatchSetResponse] -> ShowS
UpdateXssMatchSetResponse -> String
(Int -> UpdateXssMatchSetResponse -> ShowS)
-> (UpdateXssMatchSetResponse -> String)
-> ([UpdateXssMatchSetResponse] -> ShowS)
-> Show UpdateXssMatchSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateXssMatchSetResponse] -> ShowS
$cshowList :: [UpdateXssMatchSetResponse] -> ShowS
show :: UpdateXssMatchSetResponse -> String
$cshow :: UpdateXssMatchSetResponse -> String
showsPrec :: Int -> UpdateXssMatchSetResponse -> ShowS
$cshowsPrec :: Int -> UpdateXssMatchSetResponse -> ShowS
Prelude.Show, (forall x.
UpdateXssMatchSetResponse -> Rep UpdateXssMatchSetResponse x)
-> (forall x.
Rep UpdateXssMatchSetResponse x -> UpdateXssMatchSetResponse)
-> Generic UpdateXssMatchSetResponse
forall x.
Rep UpdateXssMatchSetResponse x -> UpdateXssMatchSetResponse
forall x.
UpdateXssMatchSetResponse -> Rep UpdateXssMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateXssMatchSetResponse x -> UpdateXssMatchSetResponse
$cfrom :: forall x.
UpdateXssMatchSetResponse -> Rep UpdateXssMatchSetResponse x
Prelude.Generic)
newUpdateXssMatchSetResponse ::
Prelude.Int ->
UpdateXssMatchSetResponse
newUpdateXssMatchSetResponse :: Int -> UpdateXssMatchSetResponse
newUpdateXssMatchSetResponse Int
pHttpStatus_ =
UpdateXssMatchSetResponse' :: Maybe Text -> Int -> UpdateXssMatchSetResponse
UpdateXssMatchSetResponse'
{ $sel:changeToken:UpdateXssMatchSetResponse' :: Maybe Text
changeToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateXssMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateXssMatchSetResponse_changeToken :: Lens.Lens' UpdateXssMatchSetResponse (Prelude.Maybe Prelude.Text)
updateXssMatchSetResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> UpdateXssMatchSetResponse -> f UpdateXssMatchSetResponse
updateXssMatchSetResponse_changeToken = (UpdateXssMatchSetResponse -> Maybe Text)
-> (UpdateXssMatchSetResponse
-> Maybe Text -> UpdateXssMatchSetResponse)
-> Lens
UpdateXssMatchSetResponse
UpdateXssMatchSetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateXssMatchSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:UpdateXssMatchSetResponse' :: UpdateXssMatchSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: UpdateXssMatchSetResponse
s@UpdateXssMatchSetResponse' {} Maybe Text
a -> UpdateXssMatchSetResponse
s {$sel:changeToken:UpdateXssMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: UpdateXssMatchSetResponse)
updateXssMatchSetResponse_httpStatus :: Lens.Lens' UpdateXssMatchSetResponse Prelude.Int
updateXssMatchSetResponse_httpStatus :: (Int -> f Int)
-> UpdateXssMatchSetResponse -> f UpdateXssMatchSetResponse
updateXssMatchSetResponse_httpStatus = (UpdateXssMatchSetResponse -> Int)
-> (UpdateXssMatchSetResponse -> Int -> UpdateXssMatchSetResponse)
-> Lens UpdateXssMatchSetResponse UpdateXssMatchSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateXssMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateXssMatchSetResponse' :: UpdateXssMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateXssMatchSetResponse
s@UpdateXssMatchSetResponse' {} Int
a -> UpdateXssMatchSetResponse
s {$sel:httpStatus:UpdateXssMatchSetResponse' :: Int
httpStatus = Int
a} :: UpdateXssMatchSetResponse)
instance Prelude.NFData UpdateXssMatchSetResponse