{-# 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.UpdateByteMatchSet
(
UpdateByteMatchSet (..),
newUpdateByteMatchSet,
updateByteMatchSet_byteMatchSetId,
updateByteMatchSet_changeToken,
updateByteMatchSet_updates,
UpdateByteMatchSetResponse (..),
newUpdateByteMatchSetResponse,
updateByteMatchSetResponse_changeToken,
updateByteMatchSetResponse_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 UpdateByteMatchSet = UpdateByteMatchSet'
{
UpdateByteMatchSet -> Text
byteMatchSetId :: Prelude.Text,
UpdateByteMatchSet -> Text
changeToken :: Prelude.Text,
UpdateByteMatchSet -> NonEmpty ByteMatchSetUpdate
updates :: Prelude.NonEmpty ByteMatchSetUpdate
}
deriving (UpdateByteMatchSet -> UpdateByteMatchSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateByteMatchSet -> UpdateByteMatchSet -> Bool
$c/= :: UpdateByteMatchSet -> UpdateByteMatchSet -> Bool
== :: UpdateByteMatchSet -> UpdateByteMatchSet -> Bool
$c== :: UpdateByteMatchSet -> UpdateByteMatchSet -> Bool
Prelude.Eq, ReadPrec [UpdateByteMatchSet]
ReadPrec UpdateByteMatchSet
Int -> ReadS UpdateByteMatchSet
ReadS [UpdateByteMatchSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateByteMatchSet]
$creadListPrec :: ReadPrec [UpdateByteMatchSet]
readPrec :: ReadPrec UpdateByteMatchSet
$creadPrec :: ReadPrec UpdateByteMatchSet
readList :: ReadS [UpdateByteMatchSet]
$creadList :: ReadS [UpdateByteMatchSet]
readsPrec :: Int -> ReadS UpdateByteMatchSet
$creadsPrec :: Int -> ReadS UpdateByteMatchSet
Prelude.Read, Int -> UpdateByteMatchSet -> ShowS
[UpdateByteMatchSet] -> ShowS
UpdateByteMatchSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateByteMatchSet] -> ShowS
$cshowList :: [UpdateByteMatchSet] -> ShowS
show :: UpdateByteMatchSet -> String
$cshow :: UpdateByteMatchSet -> String
showsPrec :: Int -> UpdateByteMatchSet -> ShowS
$cshowsPrec :: Int -> UpdateByteMatchSet -> ShowS
Prelude.Show, forall x. Rep UpdateByteMatchSet x -> UpdateByteMatchSet
forall x. UpdateByteMatchSet -> Rep UpdateByteMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateByteMatchSet x -> UpdateByteMatchSet
$cfrom :: forall x. UpdateByteMatchSet -> Rep UpdateByteMatchSet x
Prelude.Generic)
newUpdateByteMatchSet ::
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty ByteMatchSetUpdate ->
UpdateByteMatchSet
newUpdateByteMatchSet :: Text -> Text -> NonEmpty ByteMatchSetUpdate -> UpdateByteMatchSet
newUpdateByteMatchSet
Text
pByteMatchSetId_
Text
pChangeToken_
NonEmpty ByteMatchSetUpdate
pUpdates_ =
UpdateByteMatchSet'
{ $sel:byteMatchSetId:UpdateByteMatchSet' :: Text
byteMatchSetId =
Text
pByteMatchSetId_,
$sel:changeToken:UpdateByteMatchSet' :: Text
changeToken = Text
pChangeToken_,
$sel:updates:UpdateByteMatchSet' :: NonEmpty ByteMatchSetUpdate
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 ByteMatchSetUpdate
pUpdates_
}
updateByteMatchSet_byteMatchSetId :: Lens.Lens' UpdateByteMatchSet Prelude.Text
updateByteMatchSet_byteMatchSetId :: Lens' UpdateByteMatchSet Text
updateByteMatchSet_byteMatchSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateByteMatchSet' {Text
byteMatchSetId :: Text
$sel:byteMatchSetId:UpdateByteMatchSet' :: UpdateByteMatchSet -> Text
byteMatchSetId} -> Text
byteMatchSetId) (\s :: UpdateByteMatchSet
s@UpdateByteMatchSet' {} Text
a -> UpdateByteMatchSet
s {$sel:byteMatchSetId:UpdateByteMatchSet' :: Text
byteMatchSetId = Text
a} :: UpdateByteMatchSet)
updateByteMatchSet_changeToken :: Lens.Lens' UpdateByteMatchSet Prelude.Text
updateByteMatchSet_changeToken :: Lens' UpdateByteMatchSet Text
updateByteMatchSet_changeToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateByteMatchSet' {Text
changeToken :: Text
$sel:changeToken:UpdateByteMatchSet' :: UpdateByteMatchSet -> Text
changeToken} -> Text
changeToken) (\s :: UpdateByteMatchSet
s@UpdateByteMatchSet' {} Text
a -> UpdateByteMatchSet
s {$sel:changeToken:UpdateByteMatchSet' :: Text
changeToken = Text
a} :: UpdateByteMatchSet)
updateByteMatchSet_updates :: Lens.Lens' UpdateByteMatchSet (Prelude.NonEmpty ByteMatchSetUpdate)
updateByteMatchSet_updates :: Lens' UpdateByteMatchSet (NonEmpty ByteMatchSetUpdate)
updateByteMatchSet_updates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateByteMatchSet' {NonEmpty ByteMatchSetUpdate
updates :: NonEmpty ByteMatchSetUpdate
$sel:updates:UpdateByteMatchSet' :: UpdateByteMatchSet -> NonEmpty ByteMatchSetUpdate
updates} -> NonEmpty ByteMatchSetUpdate
updates) (\s :: UpdateByteMatchSet
s@UpdateByteMatchSet' {} NonEmpty ByteMatchSetUpdate
a -> UpdateByteMatchSet
s {$sel:updates:UpdateByteMatchSet' :: NonEmpty ByteMatchSetUpdate
updates = NonEmpty ByteMatchSetUpdate
a} :: UpdateByteMatchSet) 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 UpdateByteMatchSet where
type
AWSResponse UpdateByteMatchSet =
UpdateByteMatchSetResponse
request :: (Service -> Service)
-> UpdateByteMatchSet -> Request UpdateByteMatchSet
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 UpdateByteMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateByteMatchSet)))
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 -> UpdateByteMatchSetResponse
UpdateByteMatchSetResponse'
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 UpdateByteMatchSet where
hashWithSalt :: Int -> UpdateByteMatchSet -> Int
hashWithSalt Int
_salt UpdateByteMatchSet' {NonEmpty ByteMatchSetUpdate
Text
updates :: NonEmpty ByteMatchSetUpdate
changeToken :: Text
byteMatchSetId :: Text
$sel:updates:UpdateByteMatchSet' :: UpdateByteMatchSet -> NonEmpty ByteMatchSetUpdate
$sel:changeToken:UpdateByteMatchSet' :: UpdateByteMatchSet -> Text
$sel:byteMatchSetId:UpdateByteMatchSet' :: UpdateByteMatchSet -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
byteMatchSetId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
changeToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty ByteMatchSetUpdate
updates
instance Prelude.NFData UpdateByteMatchSet where
rnf :: UpdateByteMatchSet -> ()
rnf UpdateByteMatchSet' {NonEmpty ByteMatchSetUpdate
Text
updates :: NonEmpty ByteMatchSetUpdate
changeToken :: Text
byteMatchSetId :: Text
$sel:updates:UpdateByteMatchSet' :: UpdateByteMatchSet -> NonEmpty ByteMatchSetUpdate
$sel:changeToken:UpdateByteMatchSet' :: UpdateByteMatchSet -> Text
$sel:byteMatchSetId:UpdateByteMatchSet' :: UpdateByteMatchSet -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
byteMatchSetId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
changeToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty ByteMatchSetUpdate
updates
instance Data.ToHeaders UpdateByteMatchSet where
toHeaders :: UpdateByteMatchSet -> 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.UpdateByteMatchSet" ::
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 UpdateByteMatchSet where
toJSON :: UpdateByteMatchSet -> Value
toJSON UpdateByteMatchSet' {NonEmpty ByteMatchSetUpdate
Text
updates :: NonEmpty ByteMatchSetUpdate
changeToken :: Text
byteMatchSetId :: Text
$sel:updates:UpdateByteMatchSet' :: UpdateByteMatchSet -> NonEmpty ByteMatchSetUpdate
$sel:changeToken:UpdateByteMatchSet' :: UpdateByteMatchSet -> Text
$sel:byteMatchSetId:UpdateByteMatchSet' :: UpdateByteMatchSet -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"ByteMatchSetId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
byteMatchSetId),
forall a. a -> Maybe a
Prelude.Just (Key
"ChangeToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
changeToken),
forall a. a -> Maybe a
Prelude.Just (Key
"Updates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty ByteMatchSetUpdate
updates)
]
)
instance Data.ToPath UpdateByteMatchSet where
toPath :: UpdateByteMatchSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateByteMatchSet where
toQuery :: UpdateByteMatchSet -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateByteMatchSetResponse = UpdateByteMatchSetResponse'
{
UpdateByteMatchSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
UpdateByteMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateByteMatchSetResponse -> UpdateByteMatchSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateByteMatchSetResponse -> UpdateByteMatchSetResponse -> Bool
$c/= :: UpdateByteMatchSetResponse -> UpdateByteMatchSetResponse -> Bool
== :: UpdateByteMatchSetResponse -> UpdateByteMatchSetResponse -> Bool
$c== :: UpdateByteMatchSetResponse -> UpdateByteMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [UpdateByteMatchSetResponse]
ReadPrec UpdateByteMatchSetResponse
Int -> ReadS UpdateByteMatchSetResponse
ReadS [UpdateByteMatchSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateByteMatchSetResponse]
$creadListPrec :: ReadPrec [UpdateByteMatchSetResponse]
readPrec :: ReadPrec UpdateByteMatchSetResponse
$creadPrec :: ReadPrec UpdateByteMatchSetResponse
readList :: ReadS [UpdateByteMatchSetResponse]
$creadList :: ReadS [UpdateByteMatchSetResponse]
readsPrec :: Int -> ReadS UpdateByteMatchSetResponse
$creadsPrec :: Int -> ReadS UpdateByteMatchSetResponse
Prelude.Read, Int -> UpdateByteMatchSetResponse -> ShowS
[UpdateByteMatchSetResponse] -> ShowS
UpdateByteMatchSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateByteMatchSetResponse] -> ShowS
$cshowList :: [UpdateByteMatchSetResponse] -> ShowS
show :: UpdateByteMatchSetResponse -> String
$cshow :: UpdateByteMatchSetResponse -> String
showsPrec :: Int -> UpdateByteMatchSetResponse -> ShowS
$cshowsPrec :: Int -> UpdateByteMatchSetResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateByteMatchSetResponse x -> UpdateByteMatchSetResponse
forall x.
UpdateByteMatchSetResponse -> Rep UpdateByteMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateByteMatchSetResponse x -> UpdateByteMatchSetResponse
$cfrom :: forall x.
UpdateByteMatchSetResponse -> Rep UpdateByteMatchSetResponse x
Prelude.Generic)
newUpdateByteMatchSetResponse ::
Prelude.Int ->
UpdateByteMatchSetResponse
newUpdateByteMatchSetResponse :: Int -> UpdateByteMatchSetResponse
newUpdateByteMatchSetResponse Int
pHttpStatus_ =
UpdateByteMatchSetResponse'
{ $sel:changeToken:UpdateByteMatchSetResponse' :: Maybe Text
changeToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateByteMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateByteMatchSetResponse_changeToken :: Lens.Lens' UpdateByteMatchSetResponse (Prelude.Maybe Prelude.Text)
updateByteMatchSetResponse_changeToken :: Lens' UpdateByteMatchSetResponse (Maybe Text)
updateByteMatchSetResponse_changeToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateByteMatchSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:UpdateByteMatchSetResponse' :: UpdateByteMatchSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: UpdateByteMatchSetResponse
s@UpdateByteMatchSetResponse' {} Maybe Text
a -> UpdateByteMatchSetResponse
s {$sel:changeToken:UpdateByteMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: UpdateByteMatchSetResponse)
updateByteMatchSetResponse_httpStatus :: Lens.Lens' UpdateByteMatchSetResponse Prelude.Int
updateByteMatchSetResponse_httpStatus :: Lens' UpdateByteMatchSetResponse Int
updateByteMatchSetResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateByteMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateByteMatchSetResponse' :: UpdateByteMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateByteMatchSetResponse
s@UpdateByteMatchSetResponse' {} Int
a -> UpdateByteMatchSetResponse
s {$sel:httpStatus:UpdateByteMatchSetResponse' :: Int
httpStatus = Int
a} :: UpdateByteMatchSetResponse)
instance Prelude.NFData UpdateByteMatchSetResponse where
rnf :: UpdateByteMatchSetResponse -> ()
rnf UpdateByteMatchSetResponse' {Int
Maybe Text
httpStatus :: Int
changeToken :: Maybe Text
$sel:httpStatus:UpdateByteMatchSetResponse' :: UpdateByteMatchSetResponse -> Int
$sel:changeToken:UpdateByteMatchSetResponse' :: UpdateByteMatchSetResponse -> 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