{-# 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.Route53.GetGeoLocation
(
GetGeoLocation (..),
newGetGeoLocation,
getGeoLocation_subdivisionCode,
getGeoLocation_countryCode,
getGeoLocation_continentCode,
GetGeoLocationResponse (..),
newGetGeoLocationResponse,
getGeoLocationResponse_httpStatus,
getGeoLocationResponse_geoLocationDetails,
)
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.Route53.Types
data GetGeoLocation = GetGeoLocation'
{
GetGeoLocation -> Maybe Text
subdivisionCode :: Prelude.Maybe Prelude.Text,
GetGeoLocation -> Maybe Text
countryCode :: Prelude.Maybe Prelude.Text,
GetGeoLocation -> Maybe Text
continentCode :: Prelude.Maybe Prelude.Text
}
deriving (GetGeoLocation -> GetGeoLocation -> Bool
(GetGeoLocation -> GetGeoLocation -> Bool)
-> (GetGeoLocation -> GetGeoLocation -> Bool) -> Eq GetGeoLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGeoLocation -> GetGeoLocation -> Bool
$c/= :: GetGeoLocation -> GetGeoLocation -> Bool
== :: GetGeoLocation -> GetGeoLocation -> Bool
$c== :: GetGeoLocation -> GetGeoLocation -> Bool
Prelude.Eq, ReadPrec [GetGeoLocation]
ReadPrec GetGeoLocation
Int -> ReadS GetGeoLocation
ReadS [GetGeoLocation]
(Int -> ReadS GetGeoLocation)
-> ReadS [GetGeoLocation]
-> ReadPrec GetGeoLocation
-> ReadPrec [GetGeoLocation]
-> Read GetGeoLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGeoLocation]
$creadListPrec :: ReadPrec [GetGeoLocation]
readPrec :: ReadPrec GetGeoLocation
$creadPrec :: ReadPrec GetGeoLocation
readList :: ReadS [GetGeoLocation]
$creadList :: ReadS [GetGeoLocation]
readsPrec :: Int -> ReadS GetGeoLocation
$creadsPrec :: Int -> ReadS GetGeoLocation
Prelude.Read, Int -> GetGeoLocation -> ShowS
[GetGeoLocation] -> ShowS
GetGeoLocation -> String
(Int -> GetGeoLocation -> ShowS)
-> (GetGeoLocation -> String)
-> ([GetGeoLocation] -> ShowS)
-> Show GetGeoLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGeoLocation] -> ShowS
$cshowList :: [GetGeoLocation] -> ShowS
show :: GetGeoLocation -> String
$cshow :: GetGeoLocation -> String
showsPrec :: Int -> GetGeoLocation -> ShowS
$cshowsPrec :: Int -> GetGeoLocation -> ShowS
Prelude.Show, (forall x. GetGeoLocation -> Rep GetGeoLocation x)
-> (forall x. Rep GetGeoLocation x -> GetGeoLocation)
-> Generic GetGeoLocation
forall x. Rep GetGeoLocation x -> GetGeoLocation
forall x. GetGeoLocation -> Rep GetGeoLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGeoLocation x -> GetGeoLocation
$cfrom :: forall x. GetGeoLocation -> Rep GetGeoLocation x
Prelude.Generic)
newGetGeoLocation ::
GetGeoLocation
newGetGeoLocation :: GetGeoLocation
newGetGeoLocation =
GetGeoLocation' :: Maybe Text -> Maybe Text -> Maybe Text -> GetGeoLocation
GetGeoLocation'
{ $sel:subdivisionCode:GetGeoLocation' :: Maybe Text
subdivisionCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:countryCode:GetGeoLocation' :: Maybe Text
countryCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:continentCode:GetGeoLocation' :: Maybe Text
continentCode = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
getGeoLocation_subdivisionCode :: Lens.Lens' GetGeoLocation (Prelude.Maybe Prelude.Text)
getGeoLocation_subdivisionCode :: (Maybe Text -> f (Maybe Text))
-> GetGeoLocation -> f GetGeoLocation
getGeoLocation_subdivisionCode = (GetGeoLocation -> Maybe Text)
-> (GetGeoLocation -> Maybe Text -> GetGeoLocation)
-> Lens GetGeoLocation GetGeoLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeoLocation' {Maybe Text
subdivisionCode :: Maybe Text
$sel:subdivisionCode:GetGeoLocation' :: GetGeoLocation -> Maybe Text
subdivisionCode} -> Maybe Text
subdivisionCode) (\s :: GetGeoLocation
s@GetGeoLocation' {} Maybe Text
a -> GetGeoLocation
s {$sel:subdivisionCode:GetGeoLocation' :: Maybe Text
subdivisionCode = Maybe Text
a} :: GetGeoLocation)
getGeoLocation_countryCode :: Lens.Lens' GetGeoLocation (Prelude.Maybe Prelude.Text)
getGeoLocation_countryCode :: (Maybe Text -> f (Maybe Text))
-> GetGeoLocation -> f GetGeoLocation
getGeoLocation_countryCode = (GetGeoLocation -> Maybe Text)
-> (GetGeoLocation -> Maybe Text -> GetGeoLocation)
-> Lens GetGeoLocation GetGeoLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeoLocation' {Maybe Text
countryCode :: Maybe Text
$sel:countryCode:GetGeoLocation' :: GetGeoLocation -> Maybe Text
countryCode} -> Maybe Text
countryCode) (\s :: GetGeoLocation
s@GetGeoLocation' {} Maybe Text
a -> GetGeoLocation
s {$sel:countryCode:GetGeoLocation' :: Maybe Text
countryCode = Maybe Text
a} :: GetGeoLocation)
getGeoLocation_continentCode :: Lens.Lens' GetGeoLocation (Prelude.Maybe Prelude.Text)
getGeoLocation_continentCode :: (Maybe Text -> f (Maybe Text))
-> GetGeoLocation -> f GetGeoLocation
getGeoLocation_continentCode = (GetGeoLocation -> Maybe Text)
-> (GetGeoLocation -> Maybe Text -> GetGeoLocation)
-> Lens GetGeoLocation GetGeoLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeoLocation' {Maybe Text
continentCode :: Maybe Text
$sel:continentCode:GetGeoLocation' :: GetGeoLocation -> Maybe Text
continentCode} -> Maybe Text
continentCode) (\s :: GetGeoLocation
s@GetGeoLocation' {} Maybe Text
a -> GetGeoLocation
s {$sel:continentCode:GetGeoLocation' :: Maybe Text
continentCode = Maybe Text
a} :: GetGeoLocation)
instance Core.AWSRequest GetGeoLocation where
type
AWSResponse GetGeoLocation =
GetGeoLocationResponse
request :: GetGeoLocation -> Request GetGeoLocation
request = Service -> GetGeoLocation -> Request GetGeoLocation
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetGeoLocation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGeoLocation)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetGeoLocation))
-> Logger
-> Service
-> Proxy GetGeoLocation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGeoLocation)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> GeoLocationDetails -> GetGeoLocationResponse
GetGeoLocationResponse'
(Int -> GeoLocationDetails -> GetGeoLocationResponse)
-> Either String Int
-> Either String (GeoLocationDetails -> GetGeoLocationResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (GeoLocationDetails -> GetGeoLocationResponse)
-> Either String GeoLocationDetails
-> Either String GetGeoLocationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String GeoLocationDetails
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"GeoLocationDetails")
)
instance Prelude.Hashable GetGeoLocation
instance Prelude.NFData GetGeoLocation
instance Core.ToHeaders GetGeoLocation where
toHeaders :: GetGeoLocation -> ResponseHeaders
toHeaders = ResponseHeaders -> GetGeoLocation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetGeoLocation where
toPath :: GetGeoLocation -> ByteString
toPath = ByteString -> GetGeoLocation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2013-04-01/geolocation"
instance Core.ToQuery GetGeoLocation where
toQuery :: GetGeoLocation -> QueryString
toQuery GetGeoLocation' {Maybe Text
continentCode :: Maybe Text
countryCode :: Maybe Text
subdivisionCode :: Maybe Text
$sel:continentCode:GetGeoLocation' :: GetGeoLocation -> Maybe Text
$sel:countryCode:GetGeoLocation' :: GetGeoLocation -> Maybe Text
$sel:subdivisionCode:GetGeoLocation' :: GetGeoLocation -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"subdivisioncode" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
subdivisionCode,
ByteString
"countrycode" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
countryCode,
ByteString
"continentcode" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
continentCode
]
data GetGeoLocationResponse = GetGeoLocationResponse'
{
GetGeoLocationResponse -> Int
httpStatus :: Prelude.Int,
GetGeoLocationResponse -> GeoLocationDetails
geoLocationDetails :: GeoLocationDetails
}
deriving (GetGeoLocationResponse -> GetGeoLocationResponse -> Bool
(GetGeoLocationResponse -> GetGeoLocationResponse -> Bool)
-> (GetGeoLocationResponse -> GetGeoLocationResponse -> Bool)
-> Eq GetGeoLocationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGeoLocationResponse -> GetGeoLocationResponse -> Bool
$c/= :: GetGeoLocationResponse -> GetGeoLocationResponse -> Bool
== :: GetGeoLocationResponse -> GetGeoLocationResponse -> Bool
$c== :: GetGeoLocationResponse -> GetGeoLocationResponse -> Bool
Prelude.Eq, ReadPrec [GetGeoLocationResponse]
ReadPrec GetGeoLocationResponse
Int -> ReadS GetGeoLocationResponse
ReadS [GetGeoLocationResponse]
(Int -> ReadS GetGeoLocationResponse)
-> ReadS [GetGeoLocationResponse]
-> ReadPrec GetGeoLocationResponse
-> ReadPrec [GetGeoLocationResponse]
-> Read GetGeoLocationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGeoLocationResponse]
$creadListPrec :: ReadPrec [GetGeoLocationResponse]
readPrec :: ReadPrec GetGeoLocationResponse
$creadPrec :: ReadPrec GetGeoLocationResponse
readList :: ReadS [GetGeoLocationResponse]
$creadList :: ReadS [GetGeoLocationResponse]
readsPrec :: Int -> ReadS GetGeoLocationResponse
$creadsPrec :: Int -> ReadS GetGeoLocationResponse
Prelude.Read, Int -> GetGeoLocationResponse -> ShowS
[GetGeoLocationResponse] -> ShowS
GetGeoLocationResponse -> String
(Int -> GetGeoLocationResponse -> ShowS)
-> (GetGeoLocationResponse -> String)
-> ([GetGeoLocationResponse] -> ShowS)
-> Show GetGeoLocationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGeoLocationResponse] -> ShowS
$cshowList :: [GetGeoLocationResponse] -> ShowS
show :: GetGeoLocationResponse -> String
$cshow :: GetGeoLocationResponse -> String
showsPrec :: Int -> GetGeoLocationResponse -> ShowS
$cshowsPrec :: Int -> GetGeoLocationResponse -> ShowS
Prelude.Show, (forall x. GetGeoLocationResponse -> Rep GetGeoLocationResponse x)
-> (forall x.
Rep GetGeoLocationResponse x -> GetGeoLocationResponse)
-> Generic GetGeoLocationResponse
forall x. Rep GetGeoLocationResponse x -> GetGeoLocationResponse
forall x. GetGeoLocationResponse -> Rep GetGeoLocationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGeoLocationResponse x -> GetGeoLocationResponse
$cfrom :: forall x. GetGeoLocationResponse -> Rep GetGeoLocationResponse x
Prelude.Generic)
newGetGeoLocationResponse ::
Prelude.Int ->
GeoLocationDetails ->
GetGeoLocationResponse
newGetGeoLocationResponse :: Int -> GeoLocationDetails -> GetGeoLocationResponse
newGetGeoLocationResponse
Int
pHttpStatus_
GeoLocationDetails
pGeoLocationDetails_ =
GetGeoLocationResponse' :: Int -> GeoLocationDetails -> GetGeoLocationResponse
GetGeoLocationResponse'
{ $sel:httpStatus:GetGeoLocationResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:geoLocationDetails:GetGeoLocationResponse' :: GeoLocationDetails
geoLocationDetails = GeoLocationDetails
pGeoLocationDetails_
}
getGeoLocationResponse_httpStatus :: Lens.Lens' GetGeoLocationResponse Prelude.Int
getGeoLocationResponse_httpStatus :: (Int -> f Int)
-> GetGeoLocationResponse -> f GetGeoLocationResponse
getGeoLocationResponse_httpStatus = (GetGeoLocationResponse -> Int)
-> (GetGeoLocationResponse -> Int -> GetGeoLocationResponse)
-> Lens GetGeoLocationResponse GetGeoLocationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeoLocationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGeoLocationResponse' :: GetGeoLocationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGeoLocationResponse
s@GetGeoLocationResponse' {} Int
a -> GetGeoLocationResponse
s {$sel:httpStatus:GetGeoLocationResponse' :: Int
httpStatus = Int
a} :: GetGeoLocationResponse)
getGeoLocationResponse_geoLocationDetails :: Lens.Lens' GetGeoLocationResponse GeoLocationDetails
getGeoLocationResponse_geoLocationDetails :: (GeoLocationDetails -> f GeoLocationDetails)
-> GetGeoLocationResponse -> f GetGeoLocationResponse
getGeoLocationResponse_geoLocationDetails = (GetGeoLocationResponse -> GeoLocationDetails)
-> (GetGeoLocationResponse
-> GeoLocationDetails -> GetGeoLocationResponse)
-> Lens
GetGeoLocationResponse
GetGeoLocationResponse
GeoLocationDetails
GeoLocationDetails
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeoLocationResponse' {GeoLocationDetails
geoLocationDetails :: GeoLocationDetails
$sel:geoLocationDetails:GetGeoLocationResponse' :: GetGeoLocationResponse -> GeoLocationDetails
geoLocationDetails} -> GeoLocationDetails
geoLocationDetails) (\s :: GetGeoLocationResponse
s@GetGeoLocationResponse' {} GeoLocationDetails
a -> GetGeoLocationResponse
s {$sel:geoLocationDetails:GetGeoLocationResponse' :: GeoLocationDetails
geoLocationDetails = GeoLocationDetails
a} :: GetGeoLocationResponse)
instance Prelude.NFData GetGeoLocationResponse