{-# 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.UpdateRegexPatternSet
(
UpdateRegexPatternSet (..),
newUpdateRegexPatternSet,
updateRegexPatternSet_regexPatternSetId,
updateRegexPatternSet_updates,
updateRegexPatternSet_changeToken,
UpdateRegexPatternSetResponse (..),
newUpdateRegexPatternSetResponse,
updateRegexPatternSetResponse_changeToken,
updateRegexPatternSetResponse_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.WAF.Types
data UpdateRegexPatternSet = UpdateRegexPatternSet'
{
UpdateRegexPatternSet -> Text
regexPatternSetId :: Prelude.Text,
UpdateRegexPatternSet -> NonEmpty RegexPatternSetUpdate
updates :: Prelude.NonEmpty RegexPatternSetUpdate,
UpdateRegexPatternSet -> Text
changeToken :: Prelude.Text
}
deriving (UpdateRegexPatternSet -> UpdateRegexPatternSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRegexPatternSet -> UpdateRegexPatternSet -> Bool
$c/= :: UpdateRegexPatternSet -> UpdateRegexPatternSet -> Bool
== :: UpdateRegexPatternSet -> UpdateRegexPatternSet -> Bool
$c== :: UpdateRegexPatternSet -> UpdateRegexPatternSet -> Bool
Prelude.Eq, ReadPrec [UpdateRegexPatternSet]
ReadPrec UpdateRegexPatternSet
Int -> ReadS UpdateRegexPatternSet
ReadS [UpdateRegexPatternSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRegexPatternSet]
$creadListPrec :: ReadPrec [UpdateRegexPatternSet]
readPrec :: ReadPrec UpdateRegexPatternSet
$creadPrec :: ReadPrec UpdateRegexPatternSet
readList :: ReadS [UpdateRegexPatternSet]
$creadList :: ReadS [UpdateRegexPatternSet]
readsPrec :: Int -> ReadS UpdateRegexPatternSet
$creadsPrec :: Int -> ReadS UpdateRegexPatternSet
Prelude.Read, Int -> UpdateRegexPatternSet -> ShowS
[UpdateRegexPatternSet] -> ShowS
UpdateRegexPatternSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRegexPatternSet] -> ShowS
$cshowList :: [UpdateRegexPatternSet] -> ShowS
show :: UpdateRegexPatternSet -> String
$cshow :: UpdateRegexPatternSet -> String
showsPrec :: Int -> UpdateRegexPatternSet -> ShowS
$cshowsPrec :: Int -> UpdateRegexPatternSet -> ShowS
Prelude.Show, forall x. Rep UpdateRegexPatternSet x -> UpdateRegexPatternSet
forall x. UpdateRegexPatternSet -> Rep UpdateRegexPatternSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRegexPatternSet x -> UpdateRegexPatternSet
$cfrom :: forall x. UpdateRegexPatternSet -> Rep UpdateRegexPatternSet x
Prelude.Generic)
newUpdateRegexPatternSet ::
Prelude.Text ->
Prelude.NonEmpty RegexPatternSetUpdate ->
Prelude.Text ->
UpdateRegexPatternSet
newUpdateRegexPatternSet :: Text
-> NonEmpty RegexPatternSetUpdate -> Text -> UpdateRegexPatternSet
newUpdateRegexPatternSet
Text
pRegexPatternSetId_
NonEmpty RegexPatternSetUpdate
pUpdates_
Text
pChangeToken_ =
UpdateRegexPatternSet'
{ $sel:regexPatternSetId:UpdateRegexPatternSet' :: Text
regexPatternSetId =
Text
pRegexPatternSetId_,
$sel:updates:UpdateRegexPatternSet' :: NonEmpty RegexPatternSetUpdate
updates = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty RegexPatternSetUpdate
pUpdates_,
$sel:changeToken:UpdateRegexPatternSet' :: Text
changeToken = Text
pChangeToken_
}
updateRegexPatternSet_regexPatternSetId :: Lens.Lens' UpdateRegexPatternSet Prelude.Text
updateRegexPatternSet_regexPatternSetId :: Lens' UpdateRegexPatternSet Text
updateRegexPatternSet_regexPatternSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegexPatternSet' {Text
regexPatternSetId :: Text
$sel:regexPatternSetId:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> Text
regexPatternSetId} -> Text
regexPatternSetId) (\s :: UpdateRegexPatternSet
s@UpdateRegexPatternSet' {} Text
a -> UpdateRegexPatternSet
s {$sel:regexPatternSetId:UpdateRegexPatternSet' :: Text
regexPatternSetId = Text
a} :: UpdateRegexPatternSet)
updateRegexPatternSet_updates :: Lens.Lens' UpdateRegexPatternSet (Prelude.NonEmpty RegexPatternSetUpdate)
updateRegexPatternSet_updates :: Lens' UpdateRegexPatternSet (NonEmpty RegexPatternSetUpdate)
updateRegexPatternSet_updates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegexPatternSet' {NonEmpty RegexPatternSetUpdate
updates :: NonEmpty RegexPatternSetUpdate
$sel:updates:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> NonEmpty RegexPatternSetUpdate
updates} -> NonEmpty RegexPatternSetUpdate
updates) (\s :: UpdateRegexPatternSet
s@UpdateRegexPatternSet' {} NonEmpty RegexPatternSetUpdate
a -> UpdateRegexPatternSet
s {$sel:updates:UpdateRegexPatternSet' :: NonEmpty RegexPatternSetUpdate
updates = NonEmpty RegexPatternSetUpdate
a} :: UpdateRegexPatternSet) 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
updateRegexPatternSet_changeToken :: Lens.Lens' UpdateRegexPatternSet Prelude.Text
updateRegexPatternSet_changeToken :: Lens' UpdateRegexPatternSet Text
updateRegexPatternSet_changeToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegexPatternSet' {Text
changeToken :: Text
$sel:changeToken:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> Text
changeToken} -> Text
changeToken) (\s :: UpdateRegexPatternSet
s@UpdateRegexPatternSet' {} Text
a -> UpdateRegexPatternSet
s {$sel:changeToken:UpdateRegexPatternSet' :: Text
changeToken = Text
a} :: UpdateRegexPatternSet)
instance Core.AWSRequest UpdateRegexPatternSet where
type
AWSResponse UpdateRegexPatternSet =
UpdateRegexPatternSetResponse
request :: (Service -> Service)
-> UpdateRegexPatternSet -> Request UpdateRegexPatternSet
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 UpdateRegexPatternSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateRegexPatternSet)))
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 Text -> Int -> UpdateRegexPatternSetResponse
UpdateRegexPatternSetResponse'
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
"ChangeToken")
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 UpdateRegexPatternSet where
hashWithSalt :: Int -> UpdateRegexPatternSet -> Int
hashWithSalt Int
_salt UpdateRegexPatternSet' {NonEmpty RegexPatternSetUpdate
Text
changeToken :: Text
updates :: NonEmpty RegexPatternSetUpdate
regexPatternSetId :: Text
$sel:changeToken:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> Text
$sel:updates:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> NonEmpty RegexPatternSetUpdate
$sel:regexPatternSetId:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
regexPatternSetId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty RegexPatternSetUpdate
updates
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
changeToken
instance Prelude.NFData UpdateRegexPatternSet where
rnf :: UpdateRegexPatternSet -> ()
rnf UpdateRegexPatternSet' {NonEmpty RegexPatternSetUpdate
Text
changeToken :: Text
updates :: NonEmpty RegexPatternSetUpdate
regexPatternSetId :: Text
$sel:changeToken:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> Text
$sel:updates:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> NonEmpty RegexPatternSetUpdate
$sel:regexPatternSetId:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
regexPatternSetId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty RegexPatternSetUpdate
updates
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
changeToken
instance Data.ToHeaders UpdateRegexPatternSet where
toHeaders :: UpdateRegexPatternSet -> 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_20150824.UpdateRegexPatternSet" ::
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 UpdateRegexPatternSet where
toJSON :: UpdateRegexPatternSet -> Value
toJSON UpdateRegexPatternSet' {NonEmpty RegexPatternSetUpdate
Text
changeToken :: Text
updates :: NonEmpty RegexPatternSetUpdate
regexPatternSetId :: Text
$sel:changeToken:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> Text
$sel:updates:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> NonEmpty RegexPatternSetUpdate
$sel:regexPatternSetId:UpdateRegexPatternSet' :: UpdateRegexPatternSet -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"RegexPatternSetId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
regexPatternSetId),
forall a. a -> Maybe a
Prelude.Just (Key
"Updates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty RegexPatternSetUpdate
updates),
forall a. a -> Maybe a
Prelude.Just (Key
"ChangeToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
changeToken)
]
)
instance Data.ToPath UpdateRegexPatternSet where
toPath :: UpdateRegexPatternSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateRegexPatternSet where
toQuery :: UpdateRegexPatternSet -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateRegexPatternSetResponse = UpdateRegexPatternSetResponse'
{
UpdateRegexPatternSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
UpdateRegexPatternSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRegexPatternSetResponse
-> UpdateRegexPatternSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRegexPatternSetResponse
-> UpdateRegexPatternSetResponse -> Bool
$c/= :: UpdateRegexPatternSetResponse
-> UpdateRegexPatternSetResponse -> Bool
== :: UpdateRegexPatternSetResponse
-> UpdateRegexPatternSetResponse -> Bool
$c== :: UpdateRegexPatternSetResponse
-> UpdateRegexPatternSetResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRegexPatternSetResponse]
ReadPrec UpdateRegexPatternSetResponse
Int -> ReadS UpdateRegexPatternSetResponse
ReadS [UpdateRegexPatternSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRegexPatternSetResponse]
$creadListPrec :: ReadPrec [UpdateRegexPatternSetResponse]
readPrec :: ReadPrec UpdateRegexPatternSetResponse
$creadPrec :: ReadPrec UpdateRegexPatternSetResponse
readList :: ReadS [UpdateRegexPatternSetResponse]
$creadList :: ReadS [UpdateRegexPatternSetResponse]
readsPrec :: Int -> ReadS UpdateRegexPatternSetResponse
$creadsPrec :: Int -> ReadS UpdateRegexPatternSetResponse
Prelude.Read, Int -> UpdateRegexPatternSetResponse -> ShowS
[UpdateRegexPatternSetResponse] -> ShowS
UpdateRegexPatternSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRegexPatternSetResponse] -> ShowS
$cshowList :: [UpdateRegexPatternSetResponse] -> ShowS
show :: UpdateRegexPatternSetResponse -> String
$cshow :: UpdateRegexPatternSetResponse -> String
showsPrec :: Int -> UpdateRegexPatternSetResponse -> ShowS
$cshowsPrec :: Int -> UpdateRegexPatternSetResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateRegexPatternSetResponse x
-> UpdateRegexPatternSetResponse
forall x.
UpdateRegexPatternSetResponse
-> Rep UpdateRegexPatternSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateRegexPatternSetResponse x
-> UpdateRegexPatternSetResponse
$cfrom :: forall x.
UpdateRegexPatternSetResponse
-> Rep UpdateRegexPatternSetResponse x
Prelude.Generic)
newUpdateRegexPatternSetResponse ::
Prelude.Int ->
UpdateRegexPatternSetResponse
newUpdateRegexPatternSetResponse :: Int -> UpdateRegexPatternSetResponse
newUpdateRegexPatternSetResponse Int
pHttpStatus_ =
UpdateRegexPatternSetResponse'
{ $sel:changeToken:UpdateRegexPatternSetResponse' :: Maybe Text
changeToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateRegexPatternSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateRegexPatternSetResponse_changeToken :: Lens.Lens' UpdateRegexPatternSetResponse (Prelude.Maybe Prelude.Text)
updateRegexPatternSetResponse_changeToken :: Lens' UpdateRegexPatternSetResponse (Maybe Text)
updateRegexPatternSetResponse_changeToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegexPatternSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:UpdateRegexPatternSetResponse' :: UpdateRegexPatternSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: UpdateRegexPatternSetResponse
s@UpdateRegexPatternSetResponse' {} Maybe Text
a -> UpdateRegexPatternSetResponse
s {$sel:changeToken:UpdateRegexPatternSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: UpdateRegexPatternSetResponse)
updateRegexPatternSetResponse_httpStatus :: Lens.Lens' UpdateRegexPatternSetResponse Prelude.Int
updateRegexPatternSetResponse_httpStatus :: Lens' UpdateRegexPatternSetResponse Int
updateRegexPatternSetResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRegexPatternSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRegexPatternSetResponse' :: UpdateRegexPatternSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRegexPatternSetResponse
s@UpdateRegexPatternSetResponse' {} Int
a -> UpdateRegexPatternSetResponse
s {$sel:httpStatus:UpdateRegexPatternSetResponse' :: Int
httpStatus = Int
a} :: UpdateRegexPatternSetResponse)
instance Prelude.NFData UpdateRegexPatternSetResponse where
rnf :: UpdateRegexPatternSetResponse -> ()
rnf UpdateRegexPatternSetResponse' {Int
Maybe Text
httpStatus :: Int
changeToken :: Maybe Text
$sel:httpStatus:UpdateRegexPatternSetResponse' :: UpdateRegexPatternSetResponse -> Int
$sel:changeToken:UpdateRegexPatternSetResponse' :: UpdateRegexPatternSetResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
changeToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus