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