{-# 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.GetXssMatchSet
(
GetXssMatchSet (..),
newGetXssMatchSet,
getXssMatchSet_xssMatchSetId,
GetXssMatchSetResponse (..),
newGetXssMatchSetResponse,
getXssMatchSetResponse_xssMatchSet,
getXssMatchSetResponse_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 GetXssMatchSet = GetXssMatchSet'
{
GetXssMatchSet -> Text
xssMatchSetId :: Prelude.Text
}
deriving (GetXssMatchSet -> GetXssMatchSet -> Bool
(GetXssMatchSet -> GetXssMatchSet -> Bool)
-> (GetXssMatchSet -> GetXssMatchSet -> Bool) -> Eq GetXssMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetXssMatchSet -> GetXssMatchSet -> Bool
$c/= :: GetXssMatchSet -> GetXssMatchSet -> Bool
== :: GetXssMatchSet -> GetXssMatchSet -> Bool
$c== :: GetXssMatchSet -> GetXssMatchSet -> Bool
Prelude.Eq, ReadPrec [GetXssMatchSet]
ReadPrec GetXssMatchSet
Int -> ReadS GetXssMatchSet
ReadS [GetXssMatchSet]
(Int -> ReadS GetXssMatchSet)
-> ReadS [GetXssMatchSet]
-> ReadPrec GetXssMatchSet
-> ReadPrec [GetXssMatchSet]
-> Read GetXssMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetXssMatchSet]
$creadListPrec :: ReadPrec [GetXssMatchSet]
readPrec :: ReadPrec GetXssMatchSet
$creadPrec :: ReadPrec GetXssMatchSet
readList :: ReadS [GetXssMatchSet]
$creadList :: ReadS [GetXssMatchSet]
readsPrec :: Int -> ReadS GetXssMatchSet
$creadsPrec :: Int -> ReadS GetXssMatchSet
Prelude.Read, Int -> GetXssMatchSet -> ShowS
[GetXssMatchSet] -> ShowS
GetXssMatchSet -> String
(Int -> GetXssMatchSet -> ShowS)
-> (GetXssMatchSet -> String)
-> ([GetXssMatchSet] -> ShowS)
-> Show GetXssMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetXssMatchSet] -> ShowS
$cshowList :: [GetXssMatchSet] -> ShowS
show :: GetXssMatchSet -> String
$cshow :: GetXssMatchSet -> String
showsPrec :: Int -> GetXssMatchSet -> ShowS
$cshowsPrec :: Int -> GetXssMatchSet -> ShowS
Prelude.Show, (forall x. GetXssMatchSet -> Rep GetXssMatchSet x)
-> (forall x. Rep GetXssMatchSet x -> GetXssMatchSet)
-> Generic GetXssMatchSet
forall x. Rep GetXssMatchSet x -> GetXssMatchSet
forall x. GetXssMatchSet -> Rep GetXssMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetXssMatchSet x -> GetXssMatchSet
$cfrom :: forall x. GetXssMatchSet -> Rep GetXssMatchSet x
Prelude.Generic)
newGetXssMatchSet ::
Prelude.Text ->
GetXssMatchSet
newGetXssMatchSet :: Text -> GetXssMatchSet
newGetXssMatchSet Text
pXssMatchSetId_ =
GetXssMatchSet' :: Text -> GetXssMatchSet
GetXssMatchSet' {$sel:xssMatchSetId:GetXssMatchSet' :: Text
xssMatchSetId = Text
pXssMatchSetId_}
getXssMatchSet_xssMatchSetId :: Lens.Lens' GetXssMatchSet Prelude.Text
getXssMatchSet_xssMatchSetId :: (Text -> f Text) -> GetXssMatchSet -> f GetXssMatchSet
getXssMatchSet_xssMatchSetId = (GetXssMatchSet -> Text)
-> (GetXssMatchSet -> Text -> GetXssMatchSet)
-> Lens GetXssMatchSet GetXssMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetXssMatchSet' {Text
xssMatchSetId :: Text
$sel:xssMatchSetId:GetXssMatchSet' :: GetXssMatchSet -> Text
xssMatchSetId} -> Text
xssMatchSetId) (\s :: GetXssMatchSet
s@GetXssMatchSet' {} Text
a -> GetXssMatchSet
s {$sel:xssMatchSetId:GetXssMatchSet' :: Text
xssMatchSetId = Text
a} :: GetXssMatchSet)
instance Core.AWSRequest GetXssMatchSet where
type
AWSResponse GetXssMatchSet =
GetXssMatchSetResponse
request :: GetXssMatchSet -> Request GetXssMatchSet
request = Service -> GetXssMatchSet -> Request GetXssMatchSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetXssMatchSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetXssMatchSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetXssMatchSet))
-> Logger
-> Service
-> Proxy GetXssMatchSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetXssMatchSet)))
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 -> Int -> GetXssMatchSetResponse
GetXssMatchSetResponse'
(Maybe XssMatchSet -> Int -> GetXssMatchSetResponse)
-> Either String (Maybe XssMatchSet)
-> Either String (Int -> GetXssMatchSetResponse)
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 (Int -> GetXssMatchSetResponse)
-> Either String Int -> Either String GetXssMatchSetResponse
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 GetXssMatchSet
instance Prelude.NFData GetXssMatchSet
instance Core.ToHeaders GetXssMatchSet where
toHeaders :: GetXssMatchSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetXssMatchSet -> 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.GetXssMatchSet" ::
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 GetXssMatchSet where
toJSON :: GetXssMatchSet -> Value
toJSON GetXssMatchSet' {Text
xssMatchSetId :: Text
$sel:xssMatchSetId:GetXssMatchSet' :: GetXssMatchSet -> 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)
]
)
instance Core.ToPath GetXssMatchSet where
toPath :: GetXssMatchSet -> ByteString
toPath = ByteString -> GetXssMatchSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetXssMatchSet where
toQuery :: GetXssMatchSet -> QueryString
toQuery = QueryString -> GetXssMatchSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetXssMatchSetResponse = GetXssMatchSetResponse'
{
GetXssMatchSetResponse -> Maybe XssMatchSet
xssMatchSet :: Prelude.Maybe XssMatchSet,
GetXssMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetXssMatchSetResponse -> GetXssMatchSetResponse -> Bool
(GetXssMatchSetResponse -> GetXssMatchSetResponse -> Bool)
-> (GetXssMatchSetResponse -> GetXssMatchSetResponse -> Bool)
-> Eq GetXssMatchSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetXssMatchSetResponse -> GetXssMatchSetResponse -> Bool
$c/= :: GetXssMatchSetResponse -> GetXssMatchSetResponse -> Bool
== :: GetXssMatchSetResponse -> GetXssMatchSetResponse -> Bool
$c== :: GetXssMatchSetResponse -> GetXssMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [GetXssMatchSetResponse]
ReadPrec GetXssMatchSetResponse
Int -> ReadS GetXssMatchSetResponse
ReadS [GetXssMatchSetResponse]
(Int -> ReadS GetXssMatchSetResponse)
-> ReadS [GetXssMatchSetResponse]
-> ReadPrec GetXssMatchSetResponse
-> ReadPrec [GetXssMatchSetResponse]
-> Read GetXssMatchSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetXssMatchSetResponse]
$creadListPrec :: ReadPrec [GetXssMatchSetResponse]
readPrec :: ReadPrec GetXssMatchSetResponse
$creadPrec :: ReadPrec GetXssMatchSetResponse
readList :: ReadS [GetXssMatchSetResponse]
$creadList :: ReadS [GetXssMatchSetResponse]
readsPrec :: Int -> ReadS GetXssMatchSetResponse
$creadsPrec :: Int -> ReadS GetXssMatchSetResponse
Prelude.Read, Int -> GetXssMatchSetResponse -> ShowS
[GetXssMatchSetResponse] -> ShowS
GetXssMatchSetResponse -> String
(Int -> GetXssMatchSetResponse -> ShowS)
-> (GetXssMatchSetResponse -> String)
-> ([GetXssMatchSetResponse] -> ShowS)
-> Show GetXssMatchSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetXssMatchSetResponse] -> ShowS
$cshowList :: [GetXssMatchSetResponse] -> ShowS
show :: GetXssMatchSetResponse -> String
$cshow :: GetXssMatchSetResponse -> String
showsPrec :: Int -> GetXssMatchSetResponse -> ShowS
$cshowsPrec :: Int -> GetXssMatchSetResponse -> ShowS
Prelude.Show, (forall x. GetXssMatchSetResponse -> Rep GetXssMatchSetResponse x)
-> (forall x.
Rep GetXssMatchSetResponse x -> GetXssMatchSetResponse)
-> Generic GetXssMatchSetResponse
forall x. Rep GetXssMatchSetResponse x -> GetXssMatchSetResponse
forall x. GetXssMatchSetResponse -> Rep GetXssMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetXssMatchSetResponse x -> GetXssMatchSetResponse
$cfrom :: forall x. GetXssMatchSetResponse -> Rep GetXssMatchSetResponse x
Prelude.Generic)
newGetXssMatchSetResponse ::
Prelude.Int ->
GetXssMatchSetResponse
newGetXssMatchSetResponse :: Int -> GetXssMatchSetResponse
newGetXssMatchSetResponse Int
pHttpStatus_ =
GetXssMatchSetResponse' :: Maybe XssMatchSet -> Int -> GetXssMatchSetResponse
GetXssMatchSetResponse'
{ $sel:xssMatchSet:GetXssMatchSetResponse' :: Maybe XssMatchSet
xssMatchSet =
Maybe XssMatchSet
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetXssMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getXssMatchSetResponse_xssMatchSet :: Lens.Lens' GetXssMatchSetResponse (Prelude.Maybe XssMatchSet)
getXssMatchSetResponse_xssMatchSet :: (Maybe XssMatchSet -> f (Maybe XssMatchSet))
-> GetXssMatchSetResponse -> f GetXssMatchSetResponse
getXssMatchSetResponse_xssMatchSet = (GetXssMatchSetResponse -> Maybe XssMatchSet)
-> (GetXssMatchSetResponse
-> Maybe XssMatchSet -> GetXssMatchSetResponse)
-> Lens
GetXssMatchSetResponse
GetXssMatchSetResponse
(Maybe XssMatchSet)
(Maybe XssMatchSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetXssMatchSetResponse' {Maybe XssMatchSet
xssMatchSet :: Maybe XssMatchSet
$sel:xssMatchSet:GetXssMatchSetResponse' :: GetXssMatchSetResponse -> Maybe XssMatchSet
xssMatchSet} -> Maybe XssMatchSet
xssMatchSet) (\s :: GetXssMatchSetResponse
s@GetXssMatchSetResponse' {} Maybe XssMatchSet
a -> GetXssMatchSetResponse
s {$sel:xssMatchSet:GetXssMatchSetResponse' :: Maybe XssMatchSet
xssMatchSet = Maybe XssMatchSet
a} :: GetXssMatchSetResponse)
getXssMatchSetResponse_httpStatus :: Lens.Lens' GetXssMatchSetResponse Prelude.Int
getXssMatchSetResponse_httpStatus :: (Int -> f Int)
-> GetXssMatchSetResponse -> f GetXssMatchSetResponse
getXssMatchSetResponse_httpStatus = (GetXssMatchSetResponse -> Int)
-> (GetXssMatchSetResponse -> Int -> GetXssMatchSetResponse)
-> Lens GetXssMatchSetResponse GetXssMatchSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetXssMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetXssMatchSetResponse' :: GetXssMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetXssMatchSetResponse
s@GetXssMatchSetResponse' {} Int
a -> GetXssMatchSetResponse
s {$sel:httpStatus:GetXssMatchSetResponse' :: Int
httpStatus = Int
a} :: GetXssMatchSetResponse)
instance Prelude.NFData GetXssMatchSetResponse