{-# 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.CreateRegexPatternSet
(
CreateRegexPatternSet (..),
newCreateRegexPatternSet,
createRegexPatternSet_name,
createRegexPatternSet_changeToken,
CreateRegexPatternSetResponse (..),
newCreateRegexPatternSetResponse,
createRegexPatternSetResponse_regexPatternSet,
createRegexPatternSetResponse_changeToken,
createRegexPatternSetResponse_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 CreateRegexPatternSet = CreateRegexPatternSet'
{
CreateRegexPatternSet -> Text
name :: Prelude.Text,
CreateRegexPatternSet -> Text
changeToken :: Prelude.Text
}
deriving (CreateRegexPatternSet -> CreateRegexPatternSet -> Bool
(CreateRegexPatternSet -> CreateRegexPatternSet -> Bool)
-> (CreateRegexPatternSet -> CreateRegexPatternSet -> Bool)
-> Eq CreateRegexPatternSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRegexPatternSet -> CreateRegexPatternSet -> Bool
$c/= :: CreateRegexPatternSet -> CreateRegexPatternSet -> Bool
== :: CreateRegexPatternSet -> CreateRegexPatternSet -> Bool
$c== :: CreateRegexPatternSet -> CreateRegexPatternSet -> Bool
Prelude.Eq, ReadPrec [CreateRegexPatternSet]
ReadPrec CreateRegexPatternSet
Int -> ReadS CreateRegexPatternSet
ReadS [CreateRegexPatternSet]
(Int -> ReadS CreateRegexPatternSet)
-> ReadS [CreateRegexPatternSet]
-> ReadPrec CreateRegexPatternSet
-> ReadPrec [CreateRegexPatternSet]
-> Read CreateRegexPatternSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRegexPatternSet]
$creadListPrec :: ReadPrec [CreateRegexPatternSet]
readPrec :: ReadPrec CreateRegexPatternSet
$creadPrec :: ReadPrec CreateRegexPatternSet
readList :: ReadS [CreateRegexPatternSet]
$creadList :: ReadS [CreateRegexPatternSet]
readsPrec :: Int -> ReadS CreateRegexPatternSet
$creadsPrec :: Int -> ReadS CreateRegexPatternSet
Prelude.Read, Int -> CreateRegexPatternSet -> ShowS
[CreateRegexPatternSet] -> ShowS
CreateRegexPatternSet -> String
(Int -> CreateRegexPatternSet -> ShowS)
-> (CreateRegexPatternSet -> String)
-> ([CreateRegexPatternSet] -> ShowS)
-> Show CreateRegexPatternSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRegexPatternSet] -> ShowS
$cshowList :: [CreateRegexPatternSet] -> ShowS
show :: CreateRegexPatternSet -> String
$cshow :: CreateRegexPatternSet -> String
showsPrec :: Int -> CreateRegexPatternSet -> ShowS
$cshowsPrec :: Int -> CreateRegexPatternSet -> ShowS
Prelude.Show, (forall x. CreateRegexPatternSet -> Rep CreateRegexPatternSet x)
-> (forall x. Rep CreateRegexPatternSet x -> CreateRegexPatternSet)
-> Generic CreateRegexPatternSet
forall x. Rep CreateRegexPatternSet x -> CreateRegexPatternSet
forall x. CreateRegexPatternSet -> Rep CreateRegexPatternSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRegexPatternSet x -> CreateRegexPatternSet
$cfrom :: forall x. CreateRegexPatternSet -> Rep CreateRegexPatternSet x
Prelude.Generic)
newCreateRegexPatternSet ::
Prelude.Text ->
Prelude.Text ->
CreateRegexPatternSet
newCreateRegexPatternSet :: Text -> Text -> CreateRegexPatternSet
newCreateRegexPatternSet Text
pName_ Text
pChangeToken_ =
CreateRegexPatternSet' :: Text -> Text -> CreateRegexPatternSet
CreateRegexPatternSet'
{ $sel:name:CreateRegexPatternSet' :: Text
name = Text
pName_,
$sel:changeToken:CreateRegexPatternSet' :: Text
changeToken = Text
pChangeToken_
}
createRegexPatternSet_name :: Lens.Lens' CreateRegexPatternSet Prelude.Text
createRegexPatternSet_name :: (Text -> f Text)
-> CreateRegexPatternSet -> f CreateRegexPatternSet
createRegexPatternSet_name = (CreateRegexPatternSet -> Text)
-> (CreateRegexPatternSet -> Text -> CreateRegexPatternSet)
-> Lens CreateRegexPatternSet CreateRegexPatternSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSet' {Text
name :: Text
$sel:name:CreateRegexPatternSet' :: CreateRegexPatternSet -> Text
name} -> Text
name) (\s :: CreateRegexPatternSet
s@CreateRegexPatternSet' {} Text
a -> CreateRegexPatternSet
s {$sel:name:CreateRegexPatternSet' :: Text
name = Text
a} :: CreateRegexPatternSet)
createRegexPatternSet_changeToken :: Lens.Lens' CreateRegexPatternSet Prelude.Text
createRegexPatternSet_changeToken :: (Text -> f Text)
-> CreateRegexPatternSet -> f CreateRegexPatternSet
createRegexPatternSet_changeToken = (CreateRegexPatternSet -> Text)
-> (CreateRegexPatternSet -> Text -> CreateRegexPatternSet)
-> Lens CreateRegexPatternSet CreateRegexPatternSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSet' {Text
changeToken :: Text
$sel:changeToken:CreateRegexPatternSet' :: CreateRegexPatternSet -> Text
changeToken} -> Text
changeToken) (\s :: CreateRegexPatternSet
s@CreateRegexPatternSet' {} Text
a -> CreateRegexPatternSet
s {$sel:changeToken:CreateRegexPatternSet' :: Text
changeToken = Text
a} :: CreateRegexPatternSet)
instance Core.AWSRequest CreateRegexPatternSet where
type
AWSResponse CreateRegexPatternSet =
CreateRegexPatternSetResponse
request :: CreateRegexPatternSet -> Request CreateRegexPatternSet
request = Service -> CreateRegexPatternSet -> Request CreateRegexPatternSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateRegexPatternSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRegexPatternSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateRegexPatternSet))
-> Logger
-> Service
-> Proxy CreateRegexPatternSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRegexPatternSet)))
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 RegexPatternSet
-> Maybe Text -> Int -> CreateRegexPatternSetResponse
CreateRegexPatternSetResponse'
(Maybe RegexPatternSet
-> Maybe Text -> Int -> CreateRegexPatternSetResponse)
-> Either String (Maybe RegexPatternSet)
-> Either
String (Maybe Text -> Int -> CreateRegexPatternSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RegexPatternSet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RegexPatternSet")
Either String (Maybe Text -> Int -> CreateRegexPatternSetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateRegexPatternSetResponse)
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 -> CreateRegexPatternSetResponse)
-> Either String Int -> Either String CreateRegexPatternSetResponse
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 CreateRegexPatternSet
instance Prelude.NFData CreateRegexPatternSet
instance Core.ToHeaders CreateRegexPatternSet where
toHeaders :: CreateRegexPatternSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateRegexPatternSet -> 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.CreateRegexPatternSet" ::
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 CreateRegexPatternSet where
toJSON :: CreateRegexPatternSet -> Value
toJSON CreateRegexPatternSet' {Text
changeToken :: Text
name :: Text
$sel:changeToken:CreateRegexPatternSet' :: CreateRegexPatternSet -> Text
$sel:name:CreateRegexPatternSet' :: CreateRegexPatternSet -> 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 CreateRegexPatternSet where
toPath :: CreateRegexPatternSet -> ByteString
toPath = ByteString -> CreateRegexPatternSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateRegexPatternSet where
toQuery :: CreateRegexPatternSet -> QueryString
toQuery = QueryString -> CreateRegexPatternSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateRegexPatternSetResponse = CreateRegexPatternSetResponse'
{
CreateRegexPatternSetResponse -> Maybe RegexPatternSet
regexPatternSet :: Prelude.Maybe RegexPatternSet,
CreateRegexPatternSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
CreateRegexPatternSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateRegexPatternSetResponse
-> CreateRegexPatternSetResponse -> Bool
(CreateRegexPatternSetResponse
-> CreateRegexPatternSetResponse -> Bool)
-> (CreateRegexPatternSetResponse
-> CreateRegexPatternSetResponse -> Bool)
-> Eq CreateRegexPatternSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRegexPatternSetResponse
-> CreateRegexPatternSetResponse -> Bool
$c/= :: CreateRegexPatternSetResponse
-> CreateRegexPatternSetResponse -> Bool
== :: CreateRegexPatternSetResponse
-> CreateRegexPatternSetResponse -> Bool
$c== :: CreateRegexPatternSetResponse
-> CreateRegexPatternSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateRegexPatternSetResponse]
ReadPrec CreateRegexPatternSetResponse
Int -> ReadS CreateRegexPatternSetResponse
ReadS [CreateRegexPatternSetResponse]
(Int -> ReadS CreateRegexPatternSetResponse)
-> ReadS [CreateRegexPatternSetResponse]
-> ReadPrec CreateRegexPatternSetResponse
-> ReadPrec [CreateRegexPatternSetResponse]
-> Read CreateRegexPatternSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRegexPatternSetResponse]
$creadListPrec :: ReadPrec [CreateRegexPatternSetResponse]
readPrec :: ReadPrec CreateRegexPatternSetResponse
$creadPrec :: ReadPrec CreateRegexPatternSetResponse
readList :: ReadS [CreateRegexPatternSetResponse]
$creadList :: ReadS [CreateRegexPatternSetResponse]
readsPrec :: Int -> ReadS CreateRegexPatternSetResponse
$creadsPrec :: Int -> ReadS CreateRegexPatternSetResponse
Prelude.Read, Int -> CreateRegexPatternSetResponse -> ShowS
[CreateRegexPatternSetResponse] -> ShowS
CreateRegexPatternSetResponse -> String
(Int -> CreateRegexPatternSetResponse -> ShowS)
-> (CreateRegexPatternSetResponse -> String)
-> ([CreateRegexPatternSetResponse] -> ShowS)
-> Show CreateRegexPatternSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRegexPatternSetResponse] -> ShowS
$cshowList :: [CreateRegexPatternSetResponse] -> ShowS
show :: CreateRegexPatternSetResponse -> String
$cshow :: CreateRegexPatternSetResponse -> String
showsPrec :: Int -> CreateRegexPatternSetResponse -> ShowS
$cshowsPrec :: Int -> CreateRegexPatternSetResponse -> ShowS
Prelude.Show, (forall x.
CreateRegexPatternSetResponse
-> Rep CreateRegexPatternSetResponse x)
-> (forall x.
Rep CreateRegexPatternSetResponse x
-> CreateRegexPatternSetResponse)
-> Generic CreateRegexPatternSetResponse
forall x.
Rep CreateRegexPatternSetResponse x
-> CreateRegexPatternSetResponse
forall x.
CreateRegexPatternSetResponse
-> Rep CreateRegexPatternSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRegexPatternSetResponse x
-> CreateRegexPatternSetResponse
$cfrom :: forall x.
CreateRegexPatternSetResponse
-> Rep CreateRegexPatternSetResponse x
Prelude.Generic)
newCreateRegexPatternSetResponse ::
Prelude.Int ->
CreateRegexPatternSetResponse
newCreateRegexPatternSetResponse :: Int -> CreateRegexPatternSetResponse
newCreateRegexPatternSetResponse Int
pHttpStatus_ =
CreateRegexPatternSetResponse' :: Maybe RegexPatternSet
-> Maybe Text -> Int -> CreateRegexPatternSetResponse
CreateRegexPatternSetResponse'
{ $sel:regexPatternSet:CreateRegexPatternSetResponse' :: Maybe RegexPatternSet
regexPatternSet =
Maybe RegexPatternSet
forall a. Maybe a
Prelude.Nothing,
$sel:changeToken:CreateRegexPatternSetResponse' :: Maybe Text
changeToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateRegexPatternSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createRegexPatternSetResponse_regexPatternSet :: Lens.Lens' CreateRegexPatternSetResponse (Prelude.Maybe RegexPatternSet)
createRegexPatternSetResponse_regexPatternSet :: (Maybe RegexPatternSet -> f (Maybe RegexPatternSet))
-> CreateRegexPatternSetResponse -> f CreateRegexPatternSetResponse
createRegexPatternSetResponse_regexPatternSet = (CreateRegexPatternSetResponse -> Maybe RegexPatternSet)
-> (CreateRegexPatternSetResponse
-> Maybe RegexPatternSet -> CreateRegexPatternSetResponse)
-> Lens
CreateRegexPatternSetResponse
CreateRegexPatternSetResponse
(Maybe RegexPatternSet)
(Maybe RegexPatternSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSetResponse' {Maybe RegexPatternSet
regexPatternSet :: Maybe RegexPatternSet
$sel:regexPatternSet:CreateRegexPatternSetResponse' :: CreateRegexPatternSetResponse -> Maybe RegexPatternSet
regexPatternSet} -> Maybe RegexPatternSet
regexPatternSet) (\s :: CreateRegexPatternSetResponse
s@CreateRegexPatternSetResponse' {} Maybe RegexPatternSet
a -> CreateRegexPatternSetResponse
s {$sel:regexPatternSet:CreateRegexPatternSetResponse' :: Maybe RegexPatternSet
regexPatternSet = Maybe RegexPatternSet
a} :: CreateRegexPatternSetResponse)
createRegexPatternSetResponse_changeToken :: Lens.Lens' CreateRegexPatternSetResponse (Prelude.Maybe Prelude.Text)
createRegexPatternSetResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> CreateRegexPatternSetResponse -> f CreateRegexPatternSetResponse
createRegexPatternSetResponse_changeToken = (CreateRegexPatternSetResponse -> Maybe Text)
-> (CreateRegexPatternSetResponse
-> Maybe Text -> CreateRegexPatternSetResponse)
-> Lens
CreateRegexPatternSetResponse
CreateRegexPatternSetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:CreateRegexPatternSetResponse' :: CreateRegexPatternSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: CreateRegexPatternSetResponse
s@CreateRegexPatternSetResponse' {} Maybe Text
a -> CreateRegexPatternSetResponse
s {$sel:changeToken:CreateRegexPatternSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: CreateRegexPatternSetResponse)
createRegexPatternSetResponse_httpStatus :: Lens.Lens' CreateRegexPatternSetResponse Prelude.Int
createRegexPatternSetResponse_httpStatus :: (Int -> f Int)
-> CreateRegexPatternSetResponse -> f CreateRegexPatternSetResponse
createRegexPatternSetResponse_httpStatus = (CreateRegexPatternSetResponse -> Int)
-> (CreateRegexPatternSetResponse
-> Int -> CreateRegexPatternSetResponse)
-> Lens
CreateRegexPatternSetResponse CreateRegexPatternSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateRegexPatternSetResponse' :: CreateRegexPatternSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateRegexPatternSetResponse
s@CreateRegexPatternSetResponse' {} Int
a -> CreateRegexPatternSetResponse
s {$sel:httpStatus:CreateRegexPatternSetResponse' :: Int
httpStatus = Int
a} :: CreateRegexPatternSetResponse)
instance Prelude.NFData CreateRegexPatternSetResponse