{-# 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.GetRegexMatchSet
(
GetRegexMatchSet (..),
newGetRegexMatchSet,
getRegexMatchSet_regexMatchSetId,
GetRegexMatchSetResponse (..),
newGetRegexMatchSetResponse,
getRegexMatchSetResponse_regexMatchSet,
getRegexMatchSetResponse_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 GetRegexMatchSet = GetRegexMatchSet'
{
GetRegexMatchSet -> Text
regexMatchSetId :: Prelude.Text
}
deriving (GetRegexMatchSet -> GetRegexMatchSet -> Bool
(GetRegexMatchSet -> GetRegexMatchSet -> Bool)
-> (GetRegexMatchSet -> GetRegexMatchSet -> Bool)
-> Eq GetRegexMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegexMatchSet -> GetRegexMatchSet -> Bool
$c/= :: GetRegexMatchSet -> GetRegexMatchSet -> Bool
== :: GetRegexMatchSet -> GetRegexMatchSet -> Bool
$c== :: GetRegexMatchSet -> GetRegexMatchSet -> Bool
Prelude.Eq, ReadPrec [GetRegexMatchSet]
ReadPrec GetRegexMatchSet
Int -> ReadS GetRegexMatchSet
ReadS [GetRegexMatchSet]
(Int -> ReadS GetRegexMatchSet)
-> ReadS [GetRegexMatchSet]
-> ReadPrec GetRegexMatchSet
-> ReadPrec [GetRegexMatchSet]
-> Read GetRegexMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegexMatchSet]
$creadListPrec :: ReadPrec [GetRegexMatchSet]
readPrec :: ReadPrec GetRegexMatchSet
$creadPrec :: ReadPrec GetRegexMatchSet
readList :: ReadS [GetRegexMatchSet]
$creadList :: ReadS [GetRegexMatchSet]
readsPrec :: Int -> ReadS GetRegexMatchSet
$creadsPrec :: Int -> ReadS GetRegexMatchSet
Prelude.Read, Int -> GetRegexMatchSet -> ShowS
[GetRegexMatchSet] -> ShowS
GetRegexMatchSet -> String
(Int -> GetRegexMatchSet -> ShowS)
-> (GetRegexMatchSet -> String)
-> ([GetRegexMatchSet] -> ShowS)
-> Show GetRegexMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegexMatchSet] -> ShowS
$cshowList :: [GetRegexMatchSet] -> ShowS
show :: GetRegexMatchSet -> String
$cshow :: GetRegexMatchSet -> String
showsPrec :: Int -> GetRegexMatchSet -> ShowS
$cshowsPrec :: Int -> GetRegexMatchSet -> ShowS
Prelude.Show, (forall x. GetRegexMatchSet -> Rep GetRegexMatchSet x)
-> (forall x. Rep GetRegexMatchSet x -> GetRegexMatchSet)
-> Generic GetRegexMatchSet
forall x. Rep GetRegexMatchSet x -> GetRegexMatchSet
forall x. GetRegexMatchSet -> Rep GetRegexMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRegexMatchSet x -> GetRegexMatchSet
$cfrom :: forall x. GetRegexMatchSet -> Rep GetRegexMatchSet x
Prelude.Generic)
newGetRegexMatchSet ::
Prelude.Text ->
GetRegexMatchSet
newGetRegexMatchSet :: Text -> GetRegexMatchSet
newGetRegexMatchSet Text
pRegexMatchSetId_ =
GetRegexMatchSet' :: Text -> GetRegexMatchSet
GetRegexMatchSet'
{ $sel:regexMatchSetId:GetRegexMatchSet' :: Text
regexMatchSetId =
Text
pRegexMatchSetId_
}
getRegexMatchSet_regexMatchSetId :: Lens.Lens' GetRegexMatchSet Prelude.Text
getRegexMatchSet_regexMatchSetId :: (Text -> f Text) -> GetRegexMatchSet -> f GetRegexMatchSet
getRegexMatchSet_regexMatchSetId = (GetRegexMatchSet -> Text)
-> (GetRegexMatchSet -> Text -> GetRegexMatchSet)
-> Lens GetRegexMatchSet GetRegexMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegexMatchSet' {Text
regexMatchSetId :: Text
$sel:regexMatchSetId:GetRegexMatchSet' :: GetRegexMatchSet -> Text
regexMatchSetId} -> Text
regexMatchSetId) (\s :: GetRegexMatchSet
s@GetRegexMatchSet' {} Text
a -> GetRegexMatchSet
s {$sel:regexMatchSetId:GetRegexMatchSet' :: Text
regexMatchSetId = Text
a} :: GetRegexMatchSet)
instance Core.AWSRequest GetRegexMatchSet where
type
AWSResponse GetRegexMatchSet =
GetRegexMatchSetResponse
request :: GetRegexMatchSet -> Request GetRegexMatchSet
request = Service -> GetRegexMatchSet -> Request GetRegexMatchSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetRegexMatchSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRegexMatchSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRegexMatchSet))
-> Logger
-> Service
-> Proxy GetRegexMatchSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRegexMatchSet)))
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 RegexMatchSet -> Int -> GetRegexMatchSetResponse
GetRegexMatchSetResponse'
(Maybe RegexMatchSet -> Int -> GetRegexMatchSetResponse)
-> Either String (Maybe RegexMatchSet)
-> Either String (Int -> GetRegexMatchSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RegexMatchSet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RegexMatchSet")
Either String (Int -> GetRegexMatchSetResponse)
-> Either String Int -> Either String GetRegexMatchSetResponse
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 GetRegexMatchSet
instance Prelude.NFData GetRegexMatchSet
instance Core.ToHeaders GetRegexMatchSet where
toHeaders :: GetRegexMatchSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRegexMatchSet -> 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.GetRegexMatchSet" ::
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 GetRegexMatchSet where
toJSON :: GetRegexMatchSet -> Value
toJSON GetRegexMatchSet' {Text
regexMatchSetId :: Text
$sel:regexMatchSetId:GetRegexMatchSet' :: GetRegexMatchSet -> 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
"RegexMatchSetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
regexMatchSetId)
]
)
instance Core.ToPath GetRegexMatchSet where
toPath :: GetRegexMatchSet -> ByteString
toPath = ByteString -> GetRegexMatchSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetRegexMatchSet where
toQuery :: GetRegexMatchSet -> QueryString
toQuery = QueryString -> GetRegexMatchSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetRegexMatchSetResponse = GetRegexMatchSetResponse'
{
GetRegexMatchSetResponse -> Maybe RegexMatchSet
regexMatchSet :: Prelude.Maybe RegexMatchSet,
GetRegexMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRegexMatchSetResponse -> GetRegexMatchSetResponse -> Bool
(GetRegexMatchSetResponse -> GetRegexMatchSetResponse -> Bool)
-> (GetRegexMatchSetResponse -> GetRegexMatchSetResponse -> Bool)
-> Eq GetRegexMatchSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRegexMatchSetResponse -> GetRegexMatchSetResponse -> Bool
$c/= :: GetRegexMatchSetResponse -> GetRegexMatchSetResponse -> Bool
== :: GetRegexMatchSetResponse -> GetRegexMatchSetResponse -> Bool
$c== :: GetRegexMatchSetResponse -> GetRegexMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [GetRegexMatchSetResponse]
ReadPrec GetRegexMatchSetResponse
Int -> ReadS GetRegexMatchSetResponse
ReadS [GetRegexMatchSetResponse]
(Int -> ReadS GetRegexMatchSetResponse)
-> ReadS [GetRegexMatchSetResponse]
-> ReadPrec GetRegexMatchSetResponse
-> ReadPrec [GetRegexMatchSetResponse]
-> Read GetRegexMatchSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRegexMatchSetResponse]
$creadListPrec :: ReadPrec [GetRegexMatchSetResponse]
readPrec :: ReadPrec GetRegexMatchSetResponse
$creadPrec :: ReadPrec GetRegexMatchSetResponse
readList :: ReadS [GetRegexMatchSetResponse]
$creadList :: ReadS [GetRegexMatchSetResponse]
readsPrec :: Int -> ReadS GetRegexMatchSetResponse
$creadsPrec :: Int -> ReadS GetRegexMatchSetResponse
Prelude.Read, Int -> GetRegexMatchSetResponse -> ShowS
[GetRegexMatchSetResponse] -> ShowS
GetRegexMatchSetResponse -> String
(Int -> GetRegexMatchSetResponse -> ShowS)
-> (GetRegexMatchSetResponse -> String)
-> ([GetRegexMatchSetResponse] -> ShowS)
-> Show GetRegexMatchSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRegexMatchSetResponse] -> ShowS
$cshowList :: [GetRegexMatchSetResponse] -> ShowS
show :: GetRegexMatchSetResponse -> String
$cshow :: GetRegexMatchSetResponse -> String
showsPrec :: Int -> GetRegexMatchSetResponse -> ShowS
$cshowsPrec :: Int -> GetRegexMatchSetResponse -> ShowS
Prelude.Show, (forall x.
GetRegexMatchSetResponse -> Rep GetRegexMatchSetResponse x)
-> (forall x.
Rep GetRegexMatchSetResponse x -> GetRegexMatchSetResponse)
-> Generic GetRegexMatchSetResponse
forall x.
Rep GetRegexMatchSetResponse x -> GetRegexMatchSetResponse
forall x.
GetRegexMatchSetResponse -> Rep GetRegexMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRegexMatchSetResponse x -> GetRegexMatchSetResponse
$cfrom :: forall x.
GetRegexMatchSetResponse -> Rep GetRegexMatchSetResponse x
Prelude.Generic)
newGetRegexMatchSetResponse ::
Prelude.Int ->
GetRegexMatchSetResponse
newGetRegexMatchSetResponse :: Int -> GetRegexMatchSetResponse
newGetRegexMatchSetResponse Int
pHttpStatus_ =
GetRegexMatchSetResponse' :: Maybe RegexMatchSet -> Int -> GetRegexMatchSetResponse
GetRegexMatchSetResponse'
{ $sel:regexMatchSet:GetRegexMatchSetResponse' :: Maybe RegexMatchSet
regexMatchSet =
Maybe RegexMatchSet
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRegexMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRegexMatchSetResponse_regexMatchSet :: Lens.Lens' GetRegexMatchSetResponse (Prelude.Maybe RegexMatchSet)
getRegexMatchSetResponse_regexMatchSet :: (Maybe RegexMatchSet -> f (Maybe RegexMatchSet))
-> GetRegexMatchSetResponse -> f GetRegexMatchSetResponse
getRegexMatchSetResponse_regexMatchSet = (GetRegexMatchSetResponse -> Maybe RegexMatchSet)
-> (GetRegexMatchSetResponse
-> Maybe RegexMatchSet -> GetRegexMatchSetResponse)
-> Lens
GetRegexMatchSetResponse
GetRegexMatchSetResponse
(Maybe RegexMatchSet)
(Maybe RegexMatchSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegexMatchSetResponse' {Maybe RegexMatchSet
regexMatchSet :: Maybe RegexMatchSet
$sel:regexMatchSet:GetRegexMatchSetResponse' :: GetRegexMatchSetResponse -> Maybe RegexMatchSet
regexMatchSet} -> Maybe RegexMatchSet
regexMatchSet) (\s :: GetRegexMatchSetResponse
s@GetRegexMatchSetResponse' {} Maybe RegexMatchSet
a -> GetRegexMatchSetResponse
s {$sel:regexMatchSet:GetRegexMatchSetResponse' :: Maybe RegexMatchSet
regexMatchSet = Maybe RegexMatchSet
a} :: GetRegexMatchSetResponse)
getRegexMatchSetResponse_httpStatus :: Lens.Lens' GetRegexMatchSetResponse Prelude.Int
getRegexMatchSetResponse_httpStatus :: (Int -> f Int)
-> GetRegexMatchSetResponse -> f GetRegexMatchSetResponse
getRegexMatchSetResponse_httpStatus = (GetRegexMatchSetResponse -> Int)
-> (GetRegexMatchSetResponse -> Int -> GetRegexMatchSetResponse)
-> Lens GetRegexMatchSetResponse GetRegexMatchSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRegexMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRegexMatchSetResponse' :: GetRegexMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRegexMatchSetResponse
s@GetRegexMatchSetResponse' {} Int
a -> GetRegexMatchSetResponse
s {$sel:httpStatus:GetRegexMatchSetResponse' :: Int
httpStatus = Int
a} :: GetRegexMatchSetResponse)
instance Prelude.NFData GetRegexMatchSetResponse