{-# 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.WAFV2.CreateRegexPatternSet
(
CreateRegexPatternSet (..),
newCreateRegexPatternSet,
createRegexPatternSet_description,
createRegexPatternSet_tags,
createRegexPatternSet_name,
createRegexPatternSet_scope,
createRegexPatternSet_regularExpressionList,
CreateRegexPatternSetResponse (..),
newCreateRegexPatternSetResponse,
createRegexPatternSetResponse_summary,
createRegexPatternSetResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAFV2.Types
data CreateRegexPatternSet = CreateRegexPatternSet'
{
CreateRegexPatternSet -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateRegexPatternSet -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
CreateRegexPatternSet -> Text
name :: Prelude.Text,
CreateRegexPatternSet -> Scope
scope :: Scope,
CreateRegexPatternSet -> [Regex]
regularExpressionList :: [Regex]
}
deriving (CreateRegexPatternSet -> CreateRegexPatternSet -> Bool
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]
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
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. 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 ->
Scope ->
CreateRegexPatternSet
newCreateRegexPatternSet :: Text -> Scope -> CreateRegexPatternSet
newCreateRegexPatternSet Text
pName_ Scope
pScope_ =
CreateRegexPatternSet'
{ $sel:description:CreateRegexPatternSet' :: Maybe Text
description =
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateRegexPatternSet' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateRegexPatternSet' :: Text
name = Text
pName_,
$sel:scope:CreateRegexPatternSet' :: Scope
scope = Scope
pScope_,
$sel:regularExpressionList:CreateRegexPatternSet' :: [Regex]
regularExpressionList = forall a. Monoid a => a
Prelude.mempty
}
createRegexPatternSet_description :: Lens.Lens' CreateRegexPatternSet (Prelude.Maybe Prelude.Text)
createRegexPatternSet_description :: Lens' CreateRegexPatternSet (Maybe Text)
createRegexPatternSet_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSet' {Maybe Text
description :: Maybe Text
$sel:description:CreateRegexPatternSet' :: CreateRegexPatternSet -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateRegexPatternSet
s@CreateRegexPatternSet' {} Maybe Text
a -> CreateRegexPatternSet
s {$sel:description:CreateRegexPatternSet' :: Maybe Text
description = Maybe Text
a} :: CreateRegexPatternSet)
createRegexPatternSet_tags :: Lens.Lens' CreateRegexPatternSet (Prelude.Maybe (Prelude.NonEmpty Tag))
createRegexPatternSet_tags :: Lens' CreateRegexPatternSet (Maybe (NonEmpty Tag))
createRegexPatternSet_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSet' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateRegexPatternSet' :: CreateRegexPatternSet -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateRegexPatternSet
s@CreateRegexPatternSet' {} Maybe (NonEmpty Tag)
a -> CreateRegexPatternSet
s {$sel:tags:CreateRegexPatternSet' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateRegexPatternSet) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createRegexPatternSet_name :: Lens.Lens' CreateRegexPatternSet Prelude.Text
createRegexPatternSet_name :: Lens' CreateRegexPatternSet Text
createRegexPatternSet_name = 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_scope :: Lens.Lens' CreateRegexPatternSet Scope
createRegexPatternSet_scope :: Lens' CreateRegexPatternSet Scope
createRegexPatternSet_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSet' {Scope
scope :: Scope
$sel:scope:CreateRegexPatternSet' :: CreateRegexPatternSet -> Scope
scope} -> Scope
scope) (\s :: CreateRegexPatternSet
s@CreateRegexPatternSet' {} Scope
a -> CreateRegexPatternSet
s {$sel:scope:CreateRegexPatternSet' :: Scope
scope = Scope
a} :: CreateRegexPatternSet)
createRegexPatternSet_regularExpressionList :: Lens.Lens' CreateRegexPatternSet [Regex]
createRegexPatternSet_regularExpressionList :: Lens' CreateRegexPatternSet [Regex]
createRegexPatternSet_regularExpressionList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSet' {[Regex]
regularExpressionList :: [Regex]
$sel:regularExpressionList:CreateRegexPatternSet' :: CreateRegexPatternSet -> [Regex]
regularExpressionList} -> [Regex]
regularExpressionList) (\s :: CreateRegexPatternSet
s@CreateRegexPatternSet' {} [Regex]
a -> CreateRegexPatternSet
s {$sel:regularExpressionList:CreateRegexPatternSet' :: [Regex]
regularExpressionList = [Regex]
a} :: CreateRegexPatternSet) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateRegexPatternSet where
type
AWSResponse CreateRegexPatternSet =
CreateRegexPatternSetResponse
request :: (Service -> Service)
-> CreateRegexPatternSet -> Request CreateRegexPatternSet
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateRegexPatternSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateRegexPatternSet)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe RegexPatternSetSummary
-> Int -> CreateRegexPatternSetResponse
CreateRegexPatternSetResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Summary")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateRegexPatternSet where
hashWithSalt :: Int -> CreateRegexPatternSet -> Int
hashWithSalt Int
_salt CreateRegexPatternSet' {[Regex]
Maybe (NonEmpty Tag)
Maybe Text
Text
Scope
regularExpressionList :: [Regex]
scope :: Scope
name :: Text
tags :: Maybe (NonEmpty Tag)
description :: Maybe Text
$sel:regularExpressionList:CreateRegexPatternSet' :: CreateRegexPatternSet -> [Regex]
$sel:scope:CreateRegexPatternSet' :: CreateRegexPatternSet -> Scope
$sel:name:CreateRegexPatternSet' :: CreateRegexPatternSet -> Text
$sel:tags:CreateRegexPatternSet' :: CreateRegexPatternSet -> Maybe (NonEmpty Tag)
$sel:description:CreateRegexPatternSet' :: CreateRegexPatternSet -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Scope
scope
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Regex]
regularExpressionList
instance Prelude.NFData CreateRegexPatternSet where
rnf :: CreateRegexPatternSet -> ()
rnf CreateRegexPatternSet' {[Regex]
Maybe (NonEmpty Tag)
Maybe Text
Text
Scope
regularExpressionList :: [Regex]
scope :: Scope
name :: Text
tags :: Maybe (NonEmpty Tag)
description :: Maybe Text
$sel:regularExpressionList:CreateRegexPatternSet' :: CreateRegexPatternSet -> [Regex]
$sel:scope:CreateRegexPatternSet' :: CreateRegexPatternSet -> Scope
$sel:name:CreateRegexPatternSet' :: CreateRegexPatternSet -> Text
$sel:tags:CreateRegexPatternSet' :: CreateRegexPatternSet -> Maybe (NonEmpty Tag)
$sel:description:CreateRegexPatternSet' :: CreateRegexPatternSet -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Scope
scope
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Regex]
regularExpressionList
instance Data.ToHeaders CreateRegexPatternSet where
toHeaders :: CreateRegexPatternSet -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSWAF_20190729.CreateRegexPatternSet" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateRegexPatternSet where
toJSON :: CreateRegexPatternSet -> Value
toJSON CreateRegexPatternSet' {[Regex]
Maybe (NonEmpty Tag)
Maybe Text
Text
Scope
regularExpressionList :: [Regex]
scope :: Scope
name :: Text
tags :: Maybe (NonEmpty Tag)
description :: Maybe Text
$sel:regularExpressionList:CreateRegexPatternSet' :: CreateRegexPatternSet -> [Regex]
$sel:scope:CreateRegexPatternSet' :: CreateRegexPatternSet -> Scope
$sel:name:CreateRegexPatternSet' :: CreateRegexPatternSet -> Text
$sel:tags:CreateRegexPatternSet' :: CreateRegexPatternSet -> Maybe (NonEmpty Tag)
$sel:description:CreateRegexPatternSet' :: CreateRegexPatternSet -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Scope" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Scope
scope),
forall a. a -> Maybe a
Prelude.Just
( Key
"RegularExpressionList"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Regex]
regularExpressionList
)
]
)
instance Data.ToPath CreateRegexPatternSet where
toPath :: CreateRegexPatternSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateRegexPatternSet where
toQuery :: CreateRegexPatternSet -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateRegexPatternSetResponse = CreateRegexPatternSetResponse'
{
CreateRegexPatternSetResponse -> Maybe RegexPatternSetSummary
summary :: Prelude.Maybe RegexPatternSetSummary,
CreateRegexPatternSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateRegexPatternSetResponse
-> CreateRegexPatternSetResponse -> Bool
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]
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
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.
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'
{ $sel:summary:CreateRegexPatternSetResponse' :: Maybe RegexPatternSetSummary
summary =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateRegexPatternSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createRegexPatternSetResponse_summary :: Lens.Lens' CreateRegexPatternSetResponse (Prelude.Maybe RegexPatternSetSummary)
createRegexPatternSetResponse_summary :: Lens' CreateRegexPatternSetResponse (Maybe RegexPatternSetSummary)
createRegexPatternSetResponse_summary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRegexPatternSetResponse' {Maybe RegexPatternSetSummary
summary :: Maybe RegexPatternSetSummary
$sel:summary:CreateRegexPatternSetResponse' :: CreateRegexPatternSetResponse -> Maybe RegexPatternSetSummary
summary} -> Maybe RegexPatternSetSummary
summary) (\s :: CreateRegexPatternSetResponse
s@CreateRegexPatternSetResponse' {} Maybe RegexPatternSetSummary
a -> CreateRegexPatternSetResponse
s {$sel:summary:CreateRegexPatternSetResponse' :: Maybe RegexPatternSetSummary
summary = Maybe RegexPatternSetSummary
a} :: CreateRegexPatternSetResponse)
createRegexPatternSetResponse_httpStatus :: Lens.Lens' CreateRegexPatternSetResponse Prelude.Int
createRegexPatternSetResponse_httpStatus :: Lens' CreateRegexPatternSetResponse Int
createRegexPatternSetResponse_httpStatus = 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 where
rnf :: CreateRegexPatternSetResponse -> ()
rnf CreateRegexPatternSetResponse' {Int
Maybe RegexPatternSetSummary
httpStatus :: Int
summary :: Maybe RegexPatternSetSummary
$sel:httpStatus:CreateRegexPatternSetResponse' :: CreateRegexPatternSetResponse -> Int
$sel:summary:CreateRegexPatternSetResponse' :: CreateRegexPatternSetResponse -> Maybe RegexPatternSetSummary
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe RegexPatternSetSummary
summary
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus