{-# 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.WAF.CreateXssMatchSet
(
CreateXssMatchSet (..),
newCreateXssMatchSet,
createXssMatchSet_name,
createXssMatchSet_changeToken,
CreateXssMatchSetResponse (..),
newCreateXssMatchSetResponse,
createXssMatchSetResponse_xssMatchSet,
createXssMatchSetResponse_changeToken,
createXssMatchSetResponse_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.WAF.Types
data CreateXssMatchSet = CreateXssMatchSet'
{
CreateXssMatchSet -> Text
name :: Prelude.Text,
CreateXssMatchSet -> Text
changeToken :: Prelude.Text
}
deriving (CreateXssMatchSet -> CreateXssMatchSet -> Bool
(CreateXssMatchSet -> CreateXssMatchSet -> Bool)
-> (CreateXssMatchSet -> CreateXssMatchSet -> Bool)
-> Eq CreateXssMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateXssMatchSet -> CreateXssMatchSet -> Bool
$c/= :: CreateXssMatchSet -> CreateXssMatchSet -> Bool
== :: CreateXssMatchSet -> CreateXssMatchSet -> Bool
$c== :: CreateXssMatchSet -> CreateXssMatchSet -> Bool
Prelude.Eq, ReadPrec [CreateXssMatchSet]
ReadPrec CreateXssMatchSet
Int -> ReadS CreateXssMatchSet
ReadS [CreateXssMatchSet]
(Int -> ReadS CreateXssMatchSet)
-> ReadS [CreateXssMatchSet]
-> ReadPrec CreateXssMatchSet
-> ReadPrec [CreateXssMatchSet]
-> Read CreateXssMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateXssMatchSet]
$creadListPrec :: ReadPrec [CreateXssMatchSet]
readPrec :: ReadPrec CreateXssMatchSet
$creadPrec :: ReadPrec CreateXssMatchSet
readList :: ReadS [CreateXssMatchSet]
$creadList :: ReadS [CreateXssMatchSet]
readsPrec :: Int -> ReadS CreateXssMatchSet
$creadsPrec :: Int -> ReadS CreateXssMatchSet
Prelude.Read, Int -> CreateXssMatchSet -> ShowS
[CreateXssMatchSet] -> ShowS
CreateXssMatchSet -> String
(Int -> CreateXssMatchSet -> ShowS)
-> (CreateXssMatchSet -> String)
-> ([CreateXssMatchSet] -> ShowS)
-> Show CreateXssMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateXssMatchSet] -> ShowS
$cshowList :: [CreateXssMatchSet] -> ShowS
show :: CreateXssMatchSet -> String
$cshow :: CreateXssMatchSet -> String
showsPrec :: Int -> CreateXssMatchSet -> ShowS
$cshowsPrec :: Int -> CreateXssMatchSet -> ShowS
Prelude.Show, (forall x. CreateXssMatchSet -> Rep CreateXssMatchSet x)
-> (forall x. Rep CreateXssMatchSet x -> CreateXssMatchSet)
-> Generic CreateXssMatchSet
forall x. Rep CreateXssMatchSet x -> CreateXssMatchSet
forall x. CreateXssMatchSet -> Rep CreateXssMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateXssMatchSet x -> CreateXssMatchSet
$cfrom :: forall x. CreateXssMatchSet -> Rep CreateXssMatchSet x
Prelude.Generic)
newCreateXssMatchSet ::
Prelude.Text ->
Prelude.Text ->
CreateXssMatchSet
newCreateXssMatchSet :: Text -> Text -> CreateXssMatchSet
newCreateXssMatchSet Text
pName_ Text
pChangeToken_ =
CreateXssMatchSet' :: Text -> Text -> CreateXssMatchSet
CreateXssMatchSet'
{ $sel:name:CreateXssMatchSet' :: Text
name = Text
pName_,
$sel:changeToken:CreateXssMatchSet' :: Text
changeToken = Text
pChangeToken_
}
createXssMatchSet_name :: Lens.Lens' CreateXssMatchSet Prelude.Text
createXssMatchSet_name :: (Text -> f Text) -> CreateXssMatchSet -> f CreateXssMatchSet
createXssMatchSet_name = (CreateXssMatchSet -> Text)
-> (CreateXssMatchSet -> Text -> CreateXssMatchSet)
-> Lens CreateXssMatchSet CreateXssMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateXssMatchSet' {Text
name :: Text
$sel:name:CreateXssMatchSet' :: CreateXssMatchSet -> Text
name} -> Text
name) (\s :: CreateXssMatchSet
s@CreateXssMatchSet' {} Text
a -> CreateXssMatchSet
s {$sel:name:CreateXssMatchSet' :: Text
name = Text
a} :: CreateXssMatchSet)
createXssMatchSet_changeToken :: Lens.Lens' CreateXssMatchSet Prelude.Text
createXssMatchSet_changeToken :: (Text -> f Text) -> CreateXssMatchSet -> f CreateXssMatchSet
createXssMatchSet_changeToken = (CreateXssMatchSet -> Text)
-> (CreateXssMatchSet -> Text -> CreateXssMatchSet)
-> Lens CreateXssMatchSet CreateXssMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateXssMatchSet' {Text
changeToken :: Text
$sel:changeToken:CreateXssMatchSet' :: CreateXssMatchSet -> Text
changeToken} -> Text
changeToken) (\s :: CreateXssMatchSet
s@CreateXssMatchSet' {} Text
a -> CreateXssMatchSet
s {$sel:changeToken:CreateXssMatchSet' :: Text
changeToken = Text
a} :: CreateXssMatchSet)
instance Core.AWSRequest CreateXssMatchSet where
type
AWSResponse CreateXssMatchSet =
CreateXssMatchSetResponse
request :: CreateXssMatchSet -> Request CreateXssMatchSet
request = Service -> CreateXssMatchSet -> Request CreateXssMatchSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateXssMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateXssMatchSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateXssMatchSet))
-> Logger
-> Service
-> Proxy CreateXssMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateXssMatchSet)))
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 XssMatchSet -> Maybe Text -> Int -> CreateXssMatchSetResponse
CreateXssMatchSetResponse'
(Maybe XssMatchSet
-> Maybe Text -> Int -> CreateXssMatchSetResponse)
-> Either String (Maybe XssMatchSet)
-> Either String (Maybe Text -> Int -> CreateXssMatchSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe XssMatchSet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"XssMatchSet")
Either String (Maybe Text -> Int -> CreateXssMatchSetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateXssMatchSetResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> CreateXssMatchSetResponse)
-> Either String Int -> Either String CreateXssMatchSetResponse
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 CreateXssMatchSet
instance Prelude.NFData CreateXssMatchSet
instance Core.ToHeaders CreateXssMatchSet where
toHeaders :: CreateXssMatchSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateXssMatchSet -> 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_20150824.CreateXssMatchSet" ::
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 CreateXssMatchSet where
toJSON :: CreateXssMatchSet -> Value
toJSON CreateXssMatchSet' {Text
changeToken :: Text
name :: Text
$sel:changeToken:CreateXssMatchSet' :: CreateXssMatchSet -> Text
$sel:name:CreateXssMatchSet' :: CreateXssMatchSet -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
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)
]
)
instance Core.ToPath CreateXssMatchSet where
toPath :: CreateXssMatchSet -> ByteString
toPath = ByteString -> CreateXssMatchSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateXssMatchSet where
toQuery :: CreateXssMatchSet -> QueryString
toQuery = QueryString -> CreateXssMatchSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateXssMatchSetResponse = CreateXssMatchSetResponse'
{
CreateXssMatchSetResponse -> Maybe XssMatchSet
xssMatchSet :: Prelude.Maybe XssMatchSet,
CreateXssMatchSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
CreateXssMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateXssMatchSetResponse -> CreateXssMatchSetResponse -> Bool
(CreateXssMatchSetResponse -> CreateXssMatchSetResponse -> Bool)
-> (CreateXssMatchSetResponse -> CreateXssMatchSetResponse -> Bool)
-> Eq CreateXssMatchSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateXssMatchSetResponse -> CreateXssMatchSetResponse -> Bool
$c/= :: CreateXssMatchSetResponse -> CreateXssMatchSetResponse -> Bool
== :: CreateXssMatchSetResponse -> CreateXssMatchSetResponse -> Bool
$c== :: CreateXssMatchSetResponse -> CreateXssMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateXssMatchSetResponse]
ReadPrec CreateXssMatchSetResponse
Int -> ReadS CreateXssMatchSetResponse
ReadS [CreateXssMatchSetResponse]
(Int -> ReadS CreateXssMatchSetResponse)
-> ReadS [CreateXssMatchSetResponse]
-> ReadPrec CreateXssMatchSetResponse
-> ReadPrec [CreateXssMatchSetResponse]
-> Read CreateXssMatchSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateXssMatchSetResponse]
$creadListPrec :: ReadPrec [CreateXssMatchSetResponse]
readPrec :: ReadPrec CreateXssMatchSetResponse
$creadPrec :: ReadPrec CreateXssMatchSetResponse
readList :: ReadS [CreateXssMatchSetResponse]
$creadList :: ReadS [CreateXssMatchSetResponse]
readsPrec :: Int -> ReadS CreateXssMatchSetResponse
$creadsPrec :: Int -> ReadS CreateXssMatchSetResponse
Prelude.Read, Int -> CreateXssMatchSetResponse -> ShowS
[CreateXssMatchSetResponse] -> ShowS
CreateXssMatchSetResponse -> String
(Int -> CreateXssMatchSetResponse -> ShowS)
-> (CreateXssMatchSetResponse -> String)
-> ([CreateXssMatchSetResponse] -> ShowS)
-> Show CreateXssMatchSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateXssMatchSetResponse] -> ShowS
$cshowList :: [CreateXssMatchSetResponse] -> ShowS
show :: CreateXssMatchSetResponse -> String
$cshow :: CreateXssMatchSetResponse -> String
showsPrec :: Int -> CreateXssMatchSetResponse -> ShowS
$cshowsPrec :: Int -> CreateXssMatchSetResponse -> ShowS
Prelude.Show, (forall x.
CreateXssMatchSetResponse -> Rep CreateXssMatchSetResponse x)
-> (forall x.
Rep CreateXssMatchSetResponse x -> CreateXssMatchSetResponse)
-> Generic CreateXssMatchSetResponse
forall x.
Rep CreateXssMatchSetResponse x -> CreateXssMatchSetResponse
forall x.
CreateXssMatchSetResponse -> Rep CreateXssMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateXssMatchSetResponse x -> CreateXssMatchSetResponse
$cfrom :: forall x.
CreateXssMatchSetResponse -> Rep CreateXssMatchSetResponse x
Prelude.Generic)
newCreateXssMatchSetResponse ::
Prelude.Int ->
CreateXssMatchSetResponse
newCreateXssMatchSetResponse :: Int -> CreateXssMatchSetResponse
newCreateXssMatchSetResponse Int
pHttpStatus_ =
CreateXssMatchSetResponse' :: Maybe XssMatchSet -> Maybe Text -> Int -> CreateXssMatchSetResponse
CreateXssMatchSetResponse'
{ $sel:xssMatchSet:CreateXssMatchSetResponse' :: Maybe XssMatchSet
xssMatchSet =
Maybe XssMatchSet
forall a. Maybe a
Prelude.Nothing,
$sel:changeToken:CreateXssMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateXssMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createXssMatchSetResponse_xssMatchSet :: Lens.Lens' CreateXssMatchSetResponse (Prelude.Maybe XssMatchSet)
createXssMatchSetResponse_xssMatchSet :: (Maybe XssMatchSet -> f (Maybe XssMatchSet))
-> CreateXssMatchSetResponse -> f CreateXssMatchSetResponse
createXssMatchSetResponse_xssMatchSet = (CreateXssMatchSetResponse -> Maybe XssMatchSet)
-> (CreateXssMatchSetResponse
-> Maybe XssMatchSet -> CreateXssMatchSetResponse)
-> Lens
CreateXssMatchSetResponse
CreateXssMatchSetResponse
(Maybe XssMatchSet)
(Maybe XssMatchSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateXssMatchSetResponse' {Maybe XssMatchSet
xssMatchSet :: Maybe XssMatchSet
$sel:xssMatchSet:CreateXssMatchSetResponse' :: CreateXssMatchSetResponse -> Maybe XssMatchSet
xssMatchSet} -> Maybe XssMatchSet
xssMatchSet) (\s :: CreateXssMatchSetResponse
s@CreateXssMatchSetResponse' {} Maybe XssMatchSet
a -> CreateXssMatchSetResponse
s {$sel:xssMatchSet:CreateXssMatchSetResponse' :: Maybe XssMatchSet
xssMatchSet = Maybe XssMatchSet
a} :: CreateXssMatchSetResponse)
createXssMatchSetResponse_changeToken :: Lens.Lens' CreateXssMatchSetResponse (Prelude.Maybe Prelude.Text)
createXssMatchSetResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> CreateXssMatchSetResponse -> f CreateXssMatchSetResponse
createXssMatchSetResponse_changeToken = (CreateXssMatchSetResponse -> Maybe Text)
-> (CreateXssMatchSetResponse
-> Maybe Text -> CreateXssMatchSetResponse)
-> Lens
CreateXssMatchSetResponse
CreateXssMatchSetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateXssMatchSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:CreateXssMatchSetResponse' :: CreateXssMatchSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: CreateXssMatchSetResponse
s@CreateXssMatchSetResponse' {} Maybe Text
a -> CreateXssMatchSetResponse
s {$sel:changeToken:CreateXssMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: CreateXssMatchSetResponse)
createXssMatchSetResponse_httpStatus :: Lens.Lens' CreateXssMatchSetResponse Prelude.Int
createXssMatchSetResponse_httpStatus :: (Int -> f Int)
-> CreateXssMatchSetResponse -> f CreateXssMatchSetResponse
createXssMatchSetResponse_httpStatus = (CreateXssMatchSetResponse -> Int)
-> (CreateXssMatchSetResponse -> Int -> CreateXssMatchSetResponse)
-> Lens CreateXssMatchSetResponse CreateXssMatchSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateXssMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateXssMatchSetResponse' :: CreateXssMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateXssMatchSetResponse
s@CreateXssMatchSetResponse' {} Int
a -> CreateXssMatchSetResponse
s {$sel:httpStatus:CreateXssMatchSetResponse' :: Int
httpStatus = Int
a} :: CreateXssMatchSetResponse)
instance Prelude.NFData CreateXssMatchSetResponse