{-# 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.GetGeoMatchSet
(
GetGeoMatchSet (..),
newGetGeoMatchSet,
getGeoMatchSet_geoMatchSetId,
GetGeoMatchSetResponse (..),
newGetGeoMatchSetResponse,
getGeoMatchSetResponse_geoMatchSet,
getGeoMatchSetResponse_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 GetGeoMatchSet = GetGeoMatchSet'
{
GetGeoMatchSet -> Text
geoMatchSetId :: Prelude.Text
}
deriving (GetGeoMatchSet -> GetGeoMatchSet -> Bool
(GetGeoMatchSet -> GetGeoMatchSet -> Bool)
-> (GetGeoMatchSet -> GetGeoMatchSet -> Bool) -> Eq GetGeoMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGeoMatchSet -> GetGeoMatchSet -> Bool
$c/= :: GetGeoMatchSet -> GetGeoMatchSet -> Bool
== :: GetGeoMatchSet -> GetGeoMatchSet -> Bool
$c== :: GetGeoMatchSet -> GetGeoMatchSet -> Bool
Prelude.Eq, ReadPrec [GetGeoMatchSet]
ReadPrec GetGeoMatchSet
Int -> ReadS GetGeoMatchSet
ReadS [GetGeoMatchSet]
(Int -> ReadS GetGeoMatchSet)
-> ReadS [GetGeoMatchSet]
-> ReadPrec GetGeoMatchSet
-> ReadPrec [GetGeoMatchSet]
-> Read GetGeoMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGeoMatchSet]
$creadListPrec :: ReadPrec [GetGeoMatchSet]
readPrec :: ReadPrec GetGeoMatchSet
$creadPrec :: ReadPrec GetGeoMatchSet
readList :: ReadS [GetGeoMatchSet]
$creadList :: ReadS [GetGeoMatchSet]
readsPrec :: Int -> ReadS GetGeoMatchSet
$creadsPrec :: Int -> ReadS GetGeoMatchSet
Prelude.Read, Int -> GetGeoMatchSet -> ShowS
[GetGeoMatchSet] -> ShowS
GetGeoMatchSet -> String
(Int -> GetGeoMatchSet -> ShowS)
-> (GetGeoMatchSet -> String)
-> ([GetGeoMatchSet] -> ShowS)
-> Show GetGeoMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGeoMatchSet] -> ShowS
$cshowList :: [GetGeoMatchSet] -> ShowS
show :: GetGeoMatchSet -> String
$cshow :: GetGeoMatchSet -> String
showsPrec :: Int -> GetGeoMatchSet -> ShowS
$cshowsPrec :: Int -> GetGeoMatchSet -> ShowS
Prelude.Show, (forall x. GetGeoMatchSet -> Rep GetGeoMatchSet x)
-> (forall x. Rep GetGeoMatchSet x -> GetGeoMatchSet)
-> Generic GetGeoMatchSet
forall x. Rep GetGeoMatchSet x -> GetGeoMatchSet
forall x. GetGeoMatchSet -> Rep GetGeoMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGeoMatchSet x -> GetGeoMatchSet
$cfrom :: forall x. GetGeoMatchSet -> Rep GetGeoMatchSet x
Prelude.Generic)
newGetGeoMatchSet ::
Prelude.Text ->
GetGeoMatchSet
newGetGeoMatchSet :: Text -> GetGeoMatchSet
newGetGeoMatchSet Text
pGeoMatchSetId_ =
GetGeoMatchSet' :: Text -> GetGeoMatchSet
GetGeoMatchSet' {$sel:geoMatchSetId:GetGeoMatchSet' :: Text
geoMatchSetId = Text
pGeoMatchSetId_}
getGeoMatchSet_geoMatchSetId :: Lens.Lens' GetGeoMatchSet Prelude.Text
getGeoMatchSet_geoMatchSetId :: (Text -> f Text) -> GetGeoMatchSet -> f GetGeoMatchSet
getGeoMatchSet_geoMatchSetId = (GetGeoMatchSet -> Text)
-> (GetGeoMatchSet -> Text -> GetGeoMatchSet)
-> Lens GetGeoMatchSet GetGeoMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeoMatchSet' {Text
geoMatchSetId :: Text
$sel:geoMatchSetId:GetGeoMatchSet' :: GetGeoMatchSet -> Text
geoMatchSetId} -> Text
geoMatchSetId) (\s :: GetGeoMatchSet
s@GetGeoMatchSet' {} Text
a -> GetGeoMatchSet
s {$sel:geoMatchSetId:GetGeoMatchSet' :: Text
geoMatchSetId = Text
a} :: GetGeoMatchSet)
instance Core.AWSRequest GetGeoMatchSet where
type
AWSResponse GetGeoMatchSet =
GetGeoMatchSetResponse
request :: GetGeoMatchSet -> Request GetGeoMatchSet
request = Service -> GetGeoMatchSet -> Request GetGeoMatchSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetGeoMatchSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGeoMatchSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetGeoMatchSet))
-> Logger
-> Service
-> Proxy GetGeoMatchSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGeoMatchSet)))
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 -> Int -> GetGeoMatchSetResponse
GetGeoMatchSetResponse'
(Maybe GeoMatchSet -> Int -> GetGeoMatchSetResponse)
-> Either String (Maybe GeoMatchSet)
-> Either String (Int -> GetGeoMatchSetResponse)
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 (Int -> GetGeoMatchSetResponse)
-> Either String Int -> Either String GetGeoMatchSetResponse
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 GetGeoMatchSet
instance Prelude.NFData GetGeoMatchSet
instance Core.ToHeaders GetGeoMatchSet where
toHeaders :: GetGeoMatchSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetGeoMatchSet -> 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.GetGeoMatchSet" ::
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 GetGeoMatchSet where
toJSON :: GetGeoMatchSet -> Value
toJSON GetGeoMatchSet' {Text
geoMatchSetId :: Text
$sel:geoMatchSetId:GetGeoMatchSet' :: GetGeoMatchSet -> 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
"GeoMatchSetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
geoMatchSetId)
]
)
instance Core.ToPath GetGeoMatchSet where
toPath :: GetGeoMatchSet -> ByteString
toPath = ByteString -> GetGeoMatchSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetGeoMatchSet where
toQuery :: GetGeoMatchSet -> QueryString
toQuery = QueryString -> GetGeoMatchSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetGeoMatchSetResponse = GetGeoMatchSetResponse'
{
GetGeoMatchSetResponse -> Maybe GeoMatchSet
geoMatchSet :: Prelude.Maybe GeoMatchSet,
GetGeoMatchSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetGeoMatchSetResponse -> GetGeoMatchSetResponse -> Bool
(GetGeoMatchSetResponse -> GetGeoMatchSetResponse -> Bool)
-> (GetGeoMatchSetResponse -> GetGeoMatchSetResponse -> Bool)
-> Eq GetGeoMatchSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGeoMatchSetResponse -> GetGeoMatchSetResponse -> Bool
$c/= :: GetGeoMatchSetResponse -> GetGeoMatchSetResponse -> Bool
== :: GetGeoMatchSetResponse -> GetGeoMatchSetResponse -> Bool
$c== :: GetGeoMatchSetResponse -> GetGeoMatchSetResponse -> Bool
Prelude.Eq, ReadPrec [GetGeoMatchSetResponse]
ReadPrec GetGeoMatchSetResponse
Int -> ReadS GetGeoMatchSetResponse
ReadS [GetGeoMatchSetResponse]
(Int -> ReadS GetGeoMatchSetResponse)
-> ReadS [GetGeoMatchSetResponse]
-> ReadPrec GetGeoMatchSetResponse
-> ReadPrec [GetGeoMatchSetResponse]
-> Read GetGeoMatchSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGeoMatchSetResponse]
$creadListPrec :: ReadPrec [GetGeoMatchSetResponse]
readPrec :: ReadPrec GetGeoMatchSetResponse
$creadPrec :: ReadPrec GetGeoMatchSetResponse
readList :: ReadS [GetGeoMatchSetResponse]
$creadList :: ReadS [GetGeoMatchSetResponse]
readsPrec :: Int -> ReadS GetGeoMatchSetResponse
$creadsPrec :: Int -> ReadS GetGeoMatchSetResponse
Prelude.Read, Int -> GetGeoMatchSetResponse -> ShowS
[GetGeoMatchSetResponse] -> ShowS
GetGeoMatchSetResponse -> String
(Int -> GetGeoMatchSetResponse -> ShowS)
-> (GetGeoMatchSetResponse -> String)
-> ([GetGeoMatchSetResponse] -> ShowS)
-> Show GetGeoMatchSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGeoMatchSetResponse] -> ShowS
$cshowList :: [GetGeoMatchSetResponse] -> ShowS
show :: GetGeoMatchSetResponse -> String
$cshow :: GetGeoMatchSetResponse -> String
showsPrec :: Int -> GetGeoMatchSetResponse -> ShowS
$cshowsPrec :: Int -> GetGeoMatchSetResponse -> ShowS
Prelude.Show, (forall x. GetGeoMatchSetResponse -> Rep GetGeoMatchSetResponse x)
-> (forall x.
Rep GetGeoMatchSetResponse x -> GetGeoMatchSetResponse)
-> Generic GetGeoMatchSetResponse
forall x. Rep GetGeoMatchSetResponse x -> GetGeoMatchSetResponse
forall x. GetGeoMatchSetResponse -> Rep GetGeoMatchSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGeoMatchSetResponse x -> GetGeoMatchSetResponse
$cfrom :: forall x. GetGeoMatchSetResponse -> Rep GetGeoMatchSetResponse x
Prelude.Generic)
newGetGeoMatchSetResponse ::
Prelude.Int ->
GetGeoMatchSetResponse
newGetGeoMatchSetResponse :: Int -> GetGeoMatchSetResponse
newGetGeoMatchSetResponse Int
pHttpStatus_ =
GetGeoMatchSetResponse' :: Maybe GeoMatchSet -> Int -> GetGeoMatchSetResponse
GetGeoMatchSetResponse'
{ $sel:geoMatchSet:GetGeoMatchSetResponse' :: Maybe GeoMatchSet
geoMatchSet =
Maybe GeoMatchSet
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetGeoMatchSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getGeoMatchSetResponse_geoMatchSet :: Lens.Lens' GetGeoMatchSetResponse (Prelude.Maybe GeoMatchSet)
getGeoMatchSetResponse_geoMatchSet :: (Maybe GeoMatchSet -> f (Maybe GeoMatchSet))
-> GetGeoMatchSetResponse -> f GetGeoMatchSetResponse
getGeoMatchSetResponse_geoMatchSet = (GetGeoMatchSetResponse -> Maybe GeoMatchSet)
-> (GetGeoMatchSetResponse
-> Maybe GeoMatchSet -> GetGeoMatchSetResponse)
-> Lens
GetGeoMatchSetResponse
GetGeoMatchSetResponse
(Maybe GeoMatchSet)
(Maybe GeoMatchSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeoMatchSetResponse' {Maybe GeoMatchSet
geoMatchSet :: Maybe GeoMatchSet
$sel:geoMatchSet:GetGeoMatchSetResponse' :: GetGeoMatchSetResponse -> Maybe GeoMatchSet
geoMatchSet} -> Maybe GeoMatchSet
geoMatchSet) (\s :: GetGeoMatchSetResponse
s@GetGeoMatchSetResponse' {} Maybe GeoMatchSet
a -> GetGeoMatchSetResponse
s {$sel:geoMatchSet:GetGeoMatchSetResponse' :: Maybe GeoMatchSet
geoMatchSet = Maybe GeoMatchSet
a} :: GetGeoMatchSetResponse)
getGeoMatchSetResponse_httpStatus :: Lens.Lens' GetGeoMatchSetResponse Prelude.Int
getGeoMatchSetResponse_httpStatus :: (Int -> f Int)
-> GetGeoMatchSetResponse -> f GetGeoMatchSetResponse
getGeoMatchSetResponse_httpStatus = (GetGeoMatchSetResponse -> Int)
-> (GetGeoMatchSetResponse -> Int -> GetGeoMatchSetResponse)
-> Lens GetGeoMatchSetResponse GetGeoMatchSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeoMatchSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGeoMatchSetResponse' :: GetGeoMatchSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGeoMatchSetResponse
s@GetGeoMatchSetResponse' {} Int
a -> GetGeoMatchSetResponse
s {$sel:httpStatus:GetGeoMatchSetResponse' :: Int
httpStatus = Int
a} :: GetGeoMatchSetResponse)
instance Prelude.NFData GetGeoMatchSetResponse