{-# 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.UpdateGeoMatchSet
(
UpdateGeoMatchSet (..),
newUpdateGeoMatchSet,
updateGeoMatchSet_geoMatchSetId,
updateGeoMatchSet_changeToken,
updateGeoMatchSet_updates,
UpdateGeoMatchSetResponse (..),
newUpdateGeoMatchSetResponse,
updateGeoMatchSetResponse_changeToken,
updateGeoMatchSetResponse_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 UpdateGeoMatchSet = UpdateGeoMatchSet'
{
UpdateGeoMatchSet -> Text
geoMatchSetId :: Prelude.Text,
UpdateGeoMatchSet -> Text
changeToken :: Prelude.Text,
UpdateGeoMatchSet -> NonEmpty GeoMatchSetUpdate
updates :: Prelude.NonEmpty GeoMatchSetUpdate
}
deriving (UpdateGeoMatchSet -> UpdateGeoMatchSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGeoMatchSet -> UpdateGeoMatchSet -> Bool
$c/= :: UpdateGeoMatchSet -> UpdateGeoMatchSet -> Bool
== :: UpdateGeoMatchSet -> UpdateGeoMatchSet -> Bool
$c== :: UpdateGeoMatchSet -> UpdateGeoMatchSet -> Bool
Prelude.Eq, ReadPrec [UpdateGeoMatchSet]
ReadPrec UpdateGeoMatchSet
Int -> ReadS UpdateGeoMatchSet
ReadS [UpdateGeoMatchSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGeoMatchSet]
$creadListPrec :: ReadPrec [UpdateGeoMatchSet]
readPrec :: ReadPrec UpdateGeoMatchSet
$creadPrec :: ReadPrec UpdateGeoMatchSet
readList :: ReadS [UpdateGeoMatchSet]
$creadList :: ReadS [UpdateGeoMatchSet]
readsPrec :: Int -> ReadS UpdateGeoMatchSet
$creadsPrec :: Int -> ReadS UpdateGeoMatchSet
Prelude.Read, Int -> UpdateGeoMatchSet -> ShowS
[UpdateGeoMatchSet] -> ShowS
UpdateGeoMatchSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGeoMatchSet] -> ShowS
$cshowList :: [UpdateGeoMatchSet] -> ShowS
show :: UpdateGeoMatchSet -> String
$cshow :: UpdateGeoMatchSet -> String
showsPrec :: Int -> UpdateGeoMatchSet -> ShowS
$cshowsPrec :: Int -> UpdateGeoMatchSet -> ShowS
Prelude.Show, forall x. Rep UpdateGeoMatchSet x -> UpdateGeoMatchSet
forall x. UpdateGeoMatchSet -> Rep UpdateGeoMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateGeoMatchSet x -> UpdateGeoMatchSet
$cfrom :: forall x. UpdateGeoMatchSet -> Rep UpdateGeoMatchSet x
Prelude.Generic)
newUpdateGeoMatchSet ::
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty GeoMatchSetUpdate ->
UpdateGeoMatchSet
newUpdateGeoMatchSet :: Text -> Text -> NonEmpty GeoMatchSetUpdate -> UpdateGeoMatchSet
newUpdateGeoMatchSet
Text
pGeoMatchSetId_
Text
pChangeToken_
NonEmpty GeoMatchSetUpdate
pUpdates_ =
UpdateGeoMatchSet'
{ $sel:geoMatchSetId:UpdateGeoMatchSet' :: Text
geoMatchSetId = Text
pGeoMatchSetId_,
$sel:changeToken:UpdateGeoMatchSet' :: Text
changeToken = Text
pChangeToken_,
$sel:updates:UpdateGeoMatchSet' :: NonEmpty GeoMatchSetUpdate
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 GeoMatchSetUpdate
pUpdates_
}
updateGeoMatchSet_geoMatchSetId :: Lens.Lens' UpdateGeoMatchSet Prelude.Text
updateGeoMatchSet_geoMatchSetId :: Lens' UpdateGeoMatchSet Text
updateGeoMatchSet_geoMatchSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGeoMatchSet' {Text
geoMatchSetId :: Text
$sel:geoMatchSetId:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> Text
geoMatchSetId} -> Text
geoMatchSetId) (\s :: UpdateGeoMatchSet
s@UpdateGeoMatchSet' {} Text
a -> UpdateGeoMatchSet
s {$sel:geoMatchSetId:UpdateGeoMatchSet' :: Text
geoMatchSetId = Text
a} :: UpdateGeoMatchSet)
updateGeoMatchSet_changeToken :: Lens.Lens' UpdateGeoMatchSet Prelude.Text
updateGeoMatchSet_changeToken :: Lens' UpdateGeoMatchSet Text
updateGeoMatchSet_changeToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGeoMatchSet' {Text
changeToken :: Text
$sel:changeToken:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> Text
changeToken} -> Text
changeToken) (\s :: UpdateGeoMatchSet
s@UpdateGeoMatchSet' {} Text
a -> UpdateGeoMatchSet
s {$sel:changeToken:UpdateGeoMatchSet' :: Text
changeToken = Text
a} :: UpdateGeoMatchSet)
updateGeoMatchSet_updates :: Lens.Lens' UpdateGeoMatchSet (Prelude.NonEmpty GeoMatchSetUpdate)
updateGeoMatchSet_updates :: Lens' UpdateGeoMatchSet (NonEmpty GeoMatchSetUpdate)
updateGeoMatchSet_updates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGeoMatchSet' {NonEmpty GeoMatchSetUpdate
updates :: NonEmpty GeoMatchSetUpdate
$sel:updates:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> NonEmpty GeoMatchSetUpdate
updates} -> NonEmpty GeoMatchSetUpdate
updates) (\s :: UpdateGeoMatchSet
s@UpdateGeoMatchSet' {} NonEmpty GeoMatchSetUpdate
a -> UpdateGeoMatchSet
s {$sel:updates:UpdateGeoMatchSet' :: NonEmpty GeoMatchSetUpdate
updates = NonEmpty GeoMatchSetUpdate
a} :: UpdateGeoMatchSet) 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 UpdateGeoMatchSet where
type
AWSResponse UpdateGeoMatchSet =
UpdateGeoMatchSetResponse
request :: (Service -> Service)
-> UpdateGeoMatchSet -> Request UpdateGeoMatchSet
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 UpdateGeoMatchSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateGeoMatchSet)))
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 -> UpdateGeoMatchSetResponse
UpdateGeoMatchSetResponse'
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 UpdateGeoMatchSet where
hashWithSalt :: Int -> UpdateGeoMatchSet -> Int
hashWithSalt Int
_salt UpdateGeoMatchSet' {NonEmpty GeoMatchSetUpdate
Text
updates :: NonEmpty GeoMatchSetUpdate
changeToken :: Text
geoMatchSetId :: Text
$sel:updates:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> NonEmpty GeoMatchSetUpdate
$sel:changeToken:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> Text
$sel:geoMatchSetId:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
geoMatchSetId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
changeToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty GeoMatchSetUpdate
updates
instance Prelude.NFData UpdateGeoMatchSet where
rnf :: UpdateGeoMatchSet -> ()
rnf UpdateGeoMatchSet' {NonEmpty GeoMatchSetUpdate
Text
updates :: NonEmpty GeoMatchSetUpdate
changeToken :: Text
geoMatchSetId :: Text
$sel:updates:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> NonEmpty GeoMatchSetUpdate
$sel:changeToken:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> Text
$sel:geoMatchSetId:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
geoMatchSetId
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 GeoMatchSetUpdate
updates
instance Data.ToHeaders UpdateGeoMatchSet where
toHeaders :: UpdateGeoMatchSet -> 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.UpdateGeoMatchSet" ::
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 UpdateGeoMatchSet where
toJSON :: UpdateGeoMatchSet -> Value
toJSON UpdateGeoMatchSet' {NonEmpty GeoMatchSetUpdate
Text
updates :: NonEmpty GeoMatchSetUpdate
changeToken :: Text
geoMatchSetId :: Text
$sel:updates:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> NonEmpty GeoMatchSetUpdate
$sel:changeToken:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> Text
$sel:geoMatchSetId:UpdateGeoMatchSet' :: UpdateGeoMatchSet -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"GeoMatchSetId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
geoMatchSetId),
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 GeoMatchSetUpdate
updates)
]
)
instance Data.ToPath UpdateGeoMatchSet where
toPath :: UpdateGeoMatchSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateGeoMatchSet where
toQuery :: UpdateGeoMatchSet -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateGeoMatchSetResponse = UpdateGeoMatchSetResponse'
{
UpdateGeoMatchSetResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
UpdateGeoMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateGeoMatchSetResponse -> UpdateGeoMatchSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGeoMatchSetResponse -> UpdateGeoMatchSetResponse -> Bool
$c/= :: UpdateGeoMatchSetResponse -> UpdateGeoMatchSetResponse -> Bool
== :: UpdateGeoMatchSetResponse -> UpdateGeoMatchSetResponse -> Bool
$c== :: UpdateGeoMatchSetResponse -> UpdateGeoMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [UpdateGeoMatchSetResponse]
ReadPrec UpdateGeoMatchSetResponse
Int -> ReadS UpdateGeoMatchSetResponse
ReadS [UpdateGeoMatchSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGeoMatchSetResponse]
$creadListPrec :: ReadPrec [UpdateGeoMatchSetResponse]
readPrec :: ReadPrec UpdateGeoMatchSetResponse
$creadPrec :: ReadPrec UpdateGeoMatchSetResponse
readList :: ReadS [UpdateGeoMatchSetResponse]
$creadList :: ReadS [UpdateGeoMatchSetResponse]
readsPrec :: Int -> ReadS UpdateGeoMatchSetResponse
$creadsPrec :: Int -> ReadS UpdateGeoMatchSetResponse
Prelude.Read, Int -> UpdateGeoMatchSetResponse -> ShowS
[UpdateGeoMatchSetResponse] -> ShowS
UpdateGeoMatchSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGeoMatchSetResponse] -> ShowS
$cshowList :: [UpdateGeoMatchSetResponse] -> ShowS
show :: UpdateGeoMatchSetResponse -> String
$cshow :: UpdateGeoMatchSetResponse -> String
showsPrec :: Int -> UpdateGeoMatchSetResponse -> ShowS
$cshowsPrec :: Int -> UpdateGeoMatchSetResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateGeoMatchSetResponse x -> UpdateGeoMatchSetResponse
forall x.
UpdateGeoMatchSetResponse -> Rep UpdateGeoMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGeoMatchSetResponse x -> UpdateGeoMatchSetResponse
$cfrom :: forall x.
UpdateGeoMatchSetResponse -> Rep UpdateGeoMatchSetResponse x
Prelude.Generic)
newUpdateGeoMatchSetResponse ::
Prelude.Int ->
UpdateGeoMatchSetResponse
newUpdateGeoMatchSetResponse :: Int -> UpdateGeoMatchSetResponse
newUpdateGeoMatchSetResponse Int
pHttpStatus_ =
UpdateGeoMatchSetResponse'
{ $sel:changeToken:UpdateGeoMatchSetResponse' :: Maybe Text
changeToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateGeoMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateGeoMatchSetResponse_changeToken :: Lens.Lens' UpdateGeoMatchSetResponse (Prelude.Maybe Prelude.Text)
updateGeoMatchSetResponse_changeToken :: Lens' UpdateGeoMatchSetResponse (Maybe Text)
updateGeoMatchSetResponse_changeToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGeoMatchSetResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:UpdateGeoMatchSetResponse' :: UpdateGeoMatchSetResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: UpdateGeoMatchSetResponse
s@UpdateGeoMatchSetResponse' {} Maybe Text
a -> UpdateGeoMatchSetResponse
s {$sel:changeToken:UpdateGeoMatchSetResponse' :: Maybe Text
changeToken = Maybe Text
a} :: UpdateGeoMatchSetResponse)
updateGeoMatchSetResponse_httpStatus :: Lens.Lens' UpdateGeoMatchSetResponse Prelude.Int
updateGeoMatchSetResponse_httpStatus :: Lens' UpdateGeoMatchSetResponse Int
updateGeoMatchSetResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGeoMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateGeoMatchSetResponse' :: UpdateGeoMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateGeoMatchSetResponse
s@UpdateGeoMatchSetResponse' {} Int
a -> UpdateGeoMatchSetResponse
s {$sel:httpStatus:UpdateGeoMatchSetResponse' :: Int
httpStatus = Int
a} :: UpdateGeoMatchSetResponse)
instance Prelude.NFData UpdateGeoMatchSetResponse where
rnf :: UpdateGeoMatchSetResponse -> ()
rnf UpdateGeoMatchSetResponse' {Int
Maybe Text
httpStatus :: Int
changeToken :: Maybe Text
$sel:httpStatus:UpdateGeoMatchSetResponse' :: UpdateGeoMatchSetResponse -> Int
$sel:changeToken:UpdateGeoMatchSetResponse' :: UpdateGeoMatchSetResponse -> 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