{-# 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.CreateRegexMatchSet
(
CreateRegexMatchSet (..),
newCreateRegexMatchSet,
createRegexMatchSet_name,
createRegexMatchSet_changeToken,
CreateRegexMatchSetResponse (..),
newCreateRegexMatchSetResponse,
createRegexMatchSetResponse_regexMatchSet,
createRegexMatchSetResponse_changeToken,
createRegexMatchSetResponse_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 CreateRegexMatchSet = CreateRegexMatchSet'
{
CreateRegexMatchSet -> Text
name :: Prelude.Text,
CreateRegexMatchSet -> Text
changeToken :: Prelude.Text
}
deriving (CreateRegexMatchSet -> CreateRegexMatchSet -> Bool
(CreateRegexMatchSet -> CreateRegexMatchSet -> Bool)
-> (CreateRegexMatchSet -> CreateRegexMatchSet -> Bool)
-> Eq CreateRegexMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRegexMatchSet -> CreateRegexMatchSet -> Bool
$c/= :: CreateRegexMatchSet -> CreateRegexMatchSet -> Bool
== :: CreateRegexMatchSet -> CreateRegexMatchSet -> Bool
$c== :: CreateRegexMatchSet -> CreateRegexMatchSet -> Bool
Prelude.Eq, ReadPrec [CreateRegexMatchSet]
ReadPrec CreateRegexMatchSet
Int -> ReadS CreateRegexMatchSet
ReadS [CreateRegexMatchSet]
(Int -> ReadS CreateRegexMatchSet)
-> ReadS [CreateRegexMatchSet]
-> ReadPrec CreateRegexMatchSet
-> ReadPrec [CreateRegexMatchSet]
-> Read CreateRegexMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRegexMatchSet]
$creadListPrec :: ReadPrec [CreateRegexMatchSet]
readPrec :: ReadPrec CreateRegexMatchSet
$creadPrec :: ReadPrec CreateRegexMatchSet
readList :: ReadS [CreateRegexMatchSet]
$creadList :: ReadS [CreateRegexMatchSet]
readsPrec :: Int -> ReadS CreateRegexMatchSet
$creadsPrec :: Int -> ReadS CreateRegexMatchSet
Prelude.Read, Int -> CreateRegexMatchSet -> ShowS
[CreateRegexMatchSet] -> ShowS
CreateRegexMatchSet -> String
(Int -> CreateRegexMatchSet -> ShowS)
-> (CreateRegexMatchSet -> String)
-> ([CreateRegexMatchSet] -> ShowS)
-> Show CreateRegexMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRegexMatchSet] -> ShowS
$cshowList :: [CreateRegexMatchSet] -> ShowS
show :: CreateRegexMatchSet -> String
$cshow :: CreateRegexMatchSet -> String
showsPrec :: Int -> CreateRegexMatchSet -> ShowS
$cshowsPrec :: Int -> CreateRegexMatchSet -> ShowS
Prelude.Show, (forall x. CreateRegexMatchSet -> Rep CreateRegexMatchSet x)
-> (forall x. Rep CreateRegexMatchSet x -> CreateRegexMatchSet)
-> Generic CreateRegexMatchSet
forall x. Rep CreateRegexMatchSet x -> CreateRegexMatchSet
forall x. CreateRegexMatchSet -> Rep CreateRegexMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRegexMatchSet x -> CreateRegexMatchSet
$cfrom :: forall x. CreateRegexMatchSet -> Rep CreateRegexMatchSet x
Prelude.Generic)
newCreateRegexMatchSet ::
Prelude.Text ->
Prelude.Text ->
CreateRegexMatchSet
newCreateRegexMatchSet :: Text -> Text -> CreateRegexMatchSet
newCreateRegexMatchSet Text
pName_ Text
pChangeToken_ =
CreateRegexMatchSet' :: Text -> Text -> CreateRegexMatchSet
CreateRegexMatchSet'
{ $sel:name:CreateRegexMatchSet' :: Text
name = Text
pName_,
$sel:changeToken:CreateRegexMatchSet' :: Text
changeToken = Text
pChangeToken_
}
createRegexMatchSet_name :: Lens.Lens' CreateRegexMatchSet Prelude.Text
createRegexMatchSet_name :: (Text -> f Text) -> CreateRegexMatchSet -> f CreateRegexMatchSet
createRegexMatchSet_name = (CreateRegexMatchSet -> Text)
-> (CreateRegexMatchSet -> Text -> CreateRegexMatchSet)
-> Lens CreateRegexMatchSet CreateRegexMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexMatchSet' {Text
name :: Text
$sel:name:CreateRegexMatchSet' :: CreateRegexMatchSet -> Text
name} -> Text
name) (\s :: CreateRegexMatchSet
s@CreateRegexMatchSet' {} Text
a -> CreateRegexMatchSet
s {$sel:name:CreateRegexMatchSet' :: Text
name = Text
a} :: CreateRegexMatchSet)
createRegexMatchSet_changeToken :: Lens.Lens' CreateRegexMatchSet Prelude.Text
createRegexMatchSet_changeToken :: (Text -> f Text) -> CreateRegexMatchSet -> f CreateRegexMatchSet
createRegexMatchSet_changeToken = (CreateRegexMatchSet -> Text)
-> (CreateRegexMatchSet -> Text -> CreateRegexMatchSet)
-> Lens CreateRegexMatchSet CreateRegexMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexMatchSet' {Text
changeToken :: Text
$sel:changeToken:CreateRegexMatchSet' :: CreateRegexMatchSet -> Text
changeToken} -> Text
changeToken) (\s :: CreateRegexMatchSet
s@CreateRegexMatchSet' {} Text
a -> CreateRegexMatchSet
s {$sel:changeToken:CreateRegexMatchSet' :: Text
changeToken = Text
a} :: CreateRegexMatchSet)
instance Core.AWSRequest CreateRegexMatchSet where
type
AWSResponse CreateRegexMatchSet =
CreateRegexMatchSetResponse
request :: CreateRegexMatchSet -> Request CreateRegexMatchSet
request = Service -> CreateRegexMatchSet -> Request CreateRegexMatchSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateRegexMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRegexMatchSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateRegexMatchSet))
-> Logger
-> Service
-> Proxy CreateRegexMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRegexMatchSet)))
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
-> Maybe Text -> Int -> CreateRegexMatchSetResponse
CreateRegexMatchSetResponse'
(Maybe RegexMatchSet
-> Maybe Text -> Int -> CreateRegexMatchSetResponse)
-> Either String (Maybe RegexMatchSet)
-> Either String (Maybe Text -> Int -> CreateRegexMatchSetResponse)
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 (Maybe Text -> Int -> CreateRegexMatchSetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateRegexMatchSetResponse)
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 -> CreateRegexMatchSetResponse)
-> Either String Int -> Either String CreateRegexMatchSetResponse
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 CreateRegexMatchSet
instance Prelude.NFData CreateRegexMatchSet
instance Core.ToHeaders CreateRegexMatchSet where
toHeaders :: CreateRegexMatchSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateRegexMatchSet -> 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.CreateRegexMatchSet" ::
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 CreateRegexMatchSet where
toJSON :: CreateRegexMatchSet -> Value
toJSON CreateRegexMatchSet' {Text
changeToken :: Text
name :: Text
$sel:changeToken:CreateRegexMatchSet' :: CreateRegexMatchSet -> Text
$sel:name:CreateRegexMatchSet' :: CreateRegexMatchSet -> 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 CreateRegexMatchSet where
toPath :: CreateRegexMatchSet -> ByteString
toPath = ByteString -> CreateRegexMatchSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateRegexMatchSet where
toQuery :: CreateRegexMatchSet -> QueryString
toQuery = QueryString -> CreateRegexMatchSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateRegexMatchSetResponse = CreateRegexMatchSetResponse'
{
CreateRegexMatchSetResponse -> Maybe RegexMatchSet
regexMatchSet :: Prelude.Maybe RegexMatchSet,
CreateRegexMatchSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
CreateRegexMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateRegexMatchSetResponse -> CreateRegexMatchSetResponse -> Bool
(CreateRegexMatchSetResponse
-> CreateRegexMatchSetResponse -> Bool)
-> (CreateRegexMatchSetResponse
-> CreateRegexMatchSetResponse -> Bool)
-> Eq CreateRegexMatchSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRegexMatchSetResponse -> CreateRegexMatchSetResponse -> Bool
$c/= :: CreateRegexMatchSetResponse -> CreateRegexMatchSetResponse -> Bool
== :: CreateRegexMatchSetResponse -> CreateRegexMatchSetResponse -> Bool
$c== :: CreateRegexMatchSetResponse -> CreateRegexMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateRegexMatchSetResponse]
ReadPrec CreateRegexMatchSetResponse
Int -> ReadS CreateRegexMatchSetResponse
ReadS [CreateRegexMatchSetResponse]
(Int -> ReadS CreateRegexMatchSetResponse)
-> ReadS [CreateRegexMatchSetResponse]
-> ReadPrec CreateRegexMatchSetResponse
-> ReadPrec [CreateRegexMatchSetResponse]
-> Read CreateRegexMatchSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRegexMatchSetResponse]
$creadListPrec :: ReadPrec [CreateRegexMatchSetResponse]
readPrec :: ReadPrec CreateRegexMatchSetResponse
$creadPrec :: ReadPrec CreateRegexMatchSetResponse
readList :: ReadS [CreateRegexMatchSetResponse]
$creadList :: ReadS [CreateRegexMatchSetResponse]
readsPrec :: Int -> ReadS CreateRegexMatchSetResponse
$creadsPrec :: Int -> ReadS CreateRegexMatchSetResponse
Prelude.Read, Int -> CreateRegexMatchSetResponse -> ShowS
[CreateRegexMatchSetResponse] -> ShowS
CreateRegexMatchSetResponse -> String
(Int -> CreateRegexMatchSetResponse -> ShowS)
-> (CreateRegexMatchSetResponse -> String)
-> ([CreateRegexMatchSetResponse] -> ShowS)
-> Show CreateRegexMatchSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRegexMatchSetResponse] -> ShowS
$cshowList :: [CreateRegexMatchSetResponse] -> ShowS
show :: CreateRegexMatchSetResponse -> String
$cshow :: CreateRegexMatchSetResponse -> String
showsPrec :: Int -> CreateRegexMatchSetResponse -> ShowS
$cshowsPrec :: Int -> CreateRegexMatchSetResponse -> ShowS
Prelude.Show, (forall x.
CreateRegexMatchSetResponse -> Rep CreateRegexMatchSetResponse x)
-> (forall x.
Rep CreateRegexMatchSetResponse x -> CreateRegexMatchSetResponse)
-> Generic CreateRegexMatchSetResponse
forall x.
Rep CreateRegexMatchSetResponse x -> CreateRegexMatchSetResponse
forall x.
CreateRegexMatchSetResponse -> Rep CreateRegexMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRegexMatchSetResponse x -> CreateRegexMatchSetResponse
$cfrom :: forall x.
CreateRegexMatchSetResponse -> Rep CreateRegexMatchSetResponse x
Prelude.Generic)
newCreateRegexMatchSetResponse ::
Prelude.Int ->
CreateRegexMatchSetResponse
newCreateRegexMatchSetResponse :: Int -> CreateRegexMatchSetResponse
newCreateRegexMatchSetResponse Int
pHttpStatus_ =
CreateRegexMatchSetResponse' :: Maybe RegexMatchSet
-> Maybe Text -> Int -> CreateRegexMatchSetResponse
CreateRegexMatchSetResponse'
{ $sel:regexMatchSet:CreateRegexMatchSetResponse' :: Maybe RegexMatchSet
regexMatchSet =
Maybe RegexMatchSet
forall a. Maybe a
Prelude.Nothing,
$sel:changeToken:CreateRegexMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateRegexMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createRegexMatchSetResponse_regexMatchSet :: Lens.Lens' CreateRegexMatchSetResponse (Prelude.Maybe RegexMatchSet)
createRegexMatchSetResponse_regexMatchSet :: (Maybe RegexMatchSet -> f (Maybe RegexMatchSet))
-> CreateRegexMatchSetResponse -> f CreateRegexMatchSetResponse
createRegexMatchSetResponse_regexMatchSet = (CreateRegexMatchSetResponse -> Maybe RegexMatchSet)
-> (CreateRegexMatchSetResponse
-> Maybe RegexMatchSet -> CreateRegexMatchSetResponse)
-> Lens
CreateRegexMatchSetResponse
CreateRegexMatchSetResponse
(Maybe RegexMatchSet)
(Maybe RegexMatchSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexMatchSetResponse' {Maybe RegexMatchSet
regexMatchSet :: Maybe RegexMatchSet
$sel:regexMatchSet:CreateRegexMatchSetResponse' :: CreateRegexMatchSetResponse -> Maybe RegexMatchSet
regexMatchSet} -> Maybe RegexMatchSet
regexMatchSet) (\s :: CreateRegexMatchSetResponse
s@CreateRegexMatchSetResponse' {} Maybe RegexMatchSet
a -> CreateRegexMatchSetResponse
s {$sel:regexMatchSet:CreateRegexMatchSetResponse' :: Maybe RegexMatchSet
regexMatchSet = Maybe RegexMatchSet
a} :: CreateRegexMatchSetResponse)
createRegexMatchSetResponse_changeToken :: Lens.Lens' CreateRegexMatchSetResponse (Prelude.Maybe Prelude.Text)
createRegexMatchSetResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> CreateRegexMatchSetResponse -> f CreateRegexMatchSetResponse
createRegexMatchSetResponse_changeToken = (CreateRegexMatchSetResponse -> Maybe Text)
-> (CreateRegexMatchSetResponse
-> Maybe Text -> CreateRegexMatchSetResponse)
-> Lens
CreateRegexMatchSetResponse
CreateRegexMatchSetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexMatchSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:CreateRegexMatchSetResponse' :: CreateRegexMatchSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: CreateRegexMatchSetResponse
s@CreateRegexMatchSetResponse' {} Maybe Text
a -> CreateRegexMatchSetResponse
s {$sel:changeToken:CreateRegexMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: CreateRegexMatchSetResponse)
createRegexMatchSetResponse_httpStatus :: Lens.Lens' CreateRegexMatchSetResponse Prelude.Int
createRegexMatchSetResponse_httpStatus :: (Int -> f Int)
-> CreateRegexMatchSetResponse -> f CreateRegexMatchSetResponse
createRegexMatchSetResponse_httpStatus = (CreateRegexMatchSetResponse -> Int)
-> (CreateRegexMatchSetResponse
-> Int -> CreateRegexMatchSetResponse)
-> Lens
CreateRegexMatchSetResponse CreateRegexMatchSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateRegexMatchSetResponse' :: CreateRegexMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateRegexMatchSetResponse
s@CreateRegexMatchSetResponse' {} Int
a -> CreateRegexMatchSetResponse
s {$sel:httpStatus:CreateRegexMatchSetResponse' :: Int
httpStatus = Int
a} :: CreateRegexMatchSetResponse)
instance Prelude.NFData CreateRegexMatchSetResponse