{-# 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.Location.GetMapTile
(
GetMapTile (..),
newGetMapTile,
getMapTile_mapName,
getMapTile_x,
getMapTile_y,
getMapTile_z,
GetMapTileResponse (..),
newGetMapTileResponse,
getMapTileResponse_blob,
getMapTileResponse_contentType,
getMapTileResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Location.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetMapTile = GetMapTile'
{
GetMapTile -> Text
mapName :: Prelude.Text,
GetMapTile -> Text
x :: Prelude.Text,
GetMapTile -> Text
y :: Prelude.Text,
GetMapTile -> Text
z :: Prelude.Text
}
deriving (GetMapTile -> GetMapTile -> Bool
(GetMapTile -> GetMapTile -> Bool)
-> (GetMapTile -> GetMapTile -> Bool) -> Eq GetMapTile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMapTile -> GetMapTile -> Bool
$c/= :: GetMapTile -> GetMapTile -> Bool
== :: GetMapTile -> GetMapTile -> Bool
$c== :: GetMapTile -> GetMapTile -> Bool
Prelude.Eq, ReadPrec [GetMapTile]
ReadPrec GetMapTile
Int -> ReadS GetMapTile
ReadS [GetMapTile]
(Int -> ReadS GetMapTile)
-> ReadS [GetMapTile]
-> ReadPrec GetMapTile
-> ReadPrec [GetMapTile]
-> Read GetMapTile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMapTile]
$creadListPrec :: ReadPrec [GetMapTile]
readPrec :: ReadPrec GetMapTile
$creadPrec :: ReadPrec GetMapTile
readList :: ReadS [GetMapTile]
$creadList :: ReadS [GetMapTile]
readsPrec :: Int -> ReadS GetMapTile
$creadsPrec :: Int -> ReadS GetMapTile
Prelude.Read, Int -> GetMapTile -> ShowS
[GetMapTile] -> ShowS
GetMapTile -> String
(Int -> GetMapTile -> ShowS)
-> (GetMapTile -> String)
-> ([GetMapTile] -> ShowS)
-> Show GetMapTile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMapTile] -> ShowS
$cshowList :: [GetMapTile] -> ShowS
show :: GetMapTile -> String
$cshow :: GetMapTile -> String
showsPrec :: Int -> GetMapTile -> ShowS
$cshowsPrec :: Int -> GetMapTile -> ShowS
Prelude.Show, (forall x. GetMapTile -> Rep GetMapTile x)
-> (forall x. Rep GetMapTile x -> GetMapTile) -> Generic GetMapTile
forall x. Rep GetMapTile x -> GetMapTile
forall x. GetMapTile -> Rep GetMapTile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMapTile x -> GetMapTile
$cfrom :: forall x. GetMapTile -> Rep GetMapTile x
Prelude.Generic)
newGetMapTile ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetMapTile
newGetMapTile :: Text -> Text -> Text -> Text -> GetMapTile
newGetMapTile Text
pMapName_ Text
pX_ Text
pY_ Text
pZ_ =
GetMapTile' :: Text -> Text -> Text -> Text -> GetMapTile
GetMapTile'
{ $sel:mapName:GetMapTile' :: Text
mapName = Text
pMapName_,
$sel:x:GetMapTile' :: Text
x = Text
pX_,
$sel:y:GetMapTile' :: Text
y = Text
pY_,
$sel:z:GetMapTile' :: Text
z = Text
pZ_
}
getMapTile_mapName :: Lens.Lens' GetMapTile Prelude.Text
getMapTile_mapName :: (Text -> f Text) -> GetMapTile -> f GetMapTile
getMapTile_mapName = (GetMapTile -> Text)
-> (GetMapTile -> Text -> GetMapTile)
-> Lens GetMapTile GetMapTile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMapTile' {Text
mapName :: Text
$sel:mapName:GetMapTile' :: GetMapTile -> Text
mapName} -> Text
mapName) (\s :: GetMapTile
s@GetMapTile' {} Text
a -> GetMapTile
s {$sel:mapName:GetMapTile' :: Text
mapName = Text
a} :: GetMapTile)
getMapTile_x :: Lens.Lens' GetMapTile Prelude.Text
getMapTile_x :: (Text -> f Text) -> GetMapTile -> f GetMapTile
getMapTile_x = (GetMapTile -> Text)
-> (GetMapTile -> Text -> GetMapTile)
-> Lens GetMapTile GetMapTile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMapTile' {Text
x :: Text
$sel:x:GetMapTile' :: GetMapTile -> Text
x} -> Text
x) (\s :: GetMapTile
s@GetMapTile' {} Text
a -> GetMapTile
s {$sel:x:GetMapTile' :: Text
x = Text
a} :: GetMapTile)
getMapTile_y :: Lens.Lens' GetMapTile Prelude.Text
getMapTile_y :: (Text -> f Text) -> GetMapTile -> f GetMapTile
getMapTile_y = (GetMapTile -> Text)
-> (GetMapTile -> Text -> GetMapTile)
-> Lens GetMapTile GetMapTile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMapTile' {Text
y :: Text
$sel:y:GetMapTile' :: GetMapTile -> Text
y} -> Text
y) (\s :: GetMapTile
s@GetMapTile' {} Text
a -> GetMapTile
s {$sel:y:GetMapTile' :: Text
y = Text
a} :: GetMapTile)
getMapTile_z :: Lens.Lens' GetMapTile Prelude.Text
getMapTile_z :: (Text -> f Text) -> GetMapTile -> f GetMapTile
getMapTile_z = (GetMapTile -> Text)
-> (GetMapTile -> Text -> GetMapTile)
-> Lens GetMapTile GetMapTile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMapTile' {Text
z :: Text
$sel:z:GetMapTile' :: GetMapTile -> Text
z} -> Text
z) (\s :: GetMapTile
s@GetMapTile' {} Text
a -> GetMapTile
s {$sel:z:GetMapTile' :: Text
z = Text
a} :: GetMapTile)
instance Core.AWSRequest GetMapTile where
type AWSResponse GetMapTile = GetMapTileResponse
request :: GetMapTile -> Request GetMapTile
request = Service -> GetMapTile -> Request GetMapTile
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetMapTile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMapTile)))
response =
(Int
-> ResponseHeaders
-> ByteString
-> Either String (AWSResponse GetMapTile))
-> Logger
-> Service
-> Proxy GetMapTile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMapTile)))
forall (m :: * -> *) a.
MonadResource m =>
(Int
-> ResponseHeaders -> ByteString -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveBytes
( \Int
s ResponseHeaders
h ByteString
x ->
Maybe ByteString -> Maybe Text -> Int -> GetMapTileResponse
GetMapTileResponse'
(Maybe ByteString -> Maybe Text -> Int -> GetMapTileResponse)
-> Either String (Maybe ByteString)
-> Either String (Maybe Text -> Int -> GetMapTileResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Maybe ByteString -> Either String (Maybe ByteString)
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (ByteString -> Maybe ByteString
forall a. a -> Maybe a
Prelude.Just (ByteString -> ByteString
Prelude.coerce ByteString
x)))
Either String (Maybe Text -> Int -> GetMapTileResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetMapTileResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"Content-Type")
Either String (Int -> GetMapTileResponse)
-> Either String Int -> Either String GetMapTileResponse
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 GetMapTile
instance Prelude.NFData GetMapTile
instance Core.ToHeaders GetMapTile where
toHeaders :: GetMapTile -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetMapTile -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath GetMapTile where
toPath :: GetMapTile -> ByteString
toPath GetMapTile' {Text
z :: Text
y :: Text
x :: Text
mapName :: Text
$sel:z:GetMapTile' :: GetMapTile -> Text
$sel:y:GetMapTile' :: GetMapTile -> Text
$sel:x:GetMapTile' :: GetMapTile -> Text
$sel:mapName:GetMapTile' :: GetMapTile -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/maps/v0/maps/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
mapName,
ByteString
"/tiles/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
z,
ByteString
"/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
x,
ByteString
"/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
y
]
instance Core.ToQuery GetMapTile where
toQuery :: GetMapTile -> QueryString
toQuery = QueryString -> GetMapTile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetMapTileResponse = GetMapTileResponse'
{
GetMapTileResponse -> Maybe ByteString
blob :: Prelude.Maybe Prelude.ByteString,
GetMapTileResponse -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
GetMapTileResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMapTileResponse -> GetMapTileResponse -> Bool
(GetMapTileResponse -> GetMapTileResponse -> Bool)
-> (GetMapTileResponse -> GetMapTileResponse -> Bool)
-> Eq GetMapTileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMapTileResponse -> GetMapTileResponse -> Bool
$c/= :: GetMapTileResponse -> GetMapTileResponse -> Bool
== :: GetMapTileResponse -> GetMapTileResponse -> Bool
$c== :: GetMapTileResponse -> GetMapTileResponse -> Bool
Prelude.Eq, ReadPrec [GetMapTileResponse]
ReadPrec GetMapTileResponse
Int -> ReadS GetMapTileResponse
ReadS [GetMapTileResponse]
(Int -> ReadS GetMapTileResponse)
-> ReadS [GetMapTileResponse]
-> ReadPrec GetMapTileResponse
-> ReadPrec [GetMapTileResponse]
-> Read GetMapTileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMapTileResponse]
$creadListPrec :: ReadPrec [GetMapTileResponse]
readPrec :: ReadPrec GetMapTileResponse
$creadPrec :: ReadPrec GetMapTileResponse
readList :: ReadS [GetMapTileResponse]
$creadList :: ReadS [GetMapTileResponse]
readsPrec :: Int -> ReadS GetMapTileResponse
$creadsPrec :: Int -> ReadS GetMapTileResponse
Prelude.Read, Int -> GetMapTileResponse -> ShowS
[GetMapTileResponse] -> ShowS
GetMapTileResponse -> String
(Int -> GetMapTileResponse -> ShowS)
-> (GetMapTileResponse -> String)
-> ([GetMapTileResponse] -> ShowS)
-> Show GetMapTileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMapTileResponse] -> ShowS
$cshowList :: [GetMapTileResponse] -> ShowS
show :: GetMapTileResponse -> String
$cshow :: GetMapTileResponse -> String
showsPrec :: Int -> GetMapTileResponse -> ShowS
$cshowsPrec :: Int -> GetMapTileResponse -> ShowS
Prelude.Show, (forall x. GetMapTileResponse -> Rep GetMapTileResponse x)
-> (forall x. Rep GetMapTileResponse x -> GetMapTileResponse)
-> Generic GetMapTileResponse
forall x. Rep GetMapTileResponse x -> GetMapTileResponse
forall x. GetMapTileResponse -> Rep GetMapTileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMapTileResponse x -> GetMapTileResponse
$cfrom :: forall x. GetMapTileResponse -> Rep GetMapTileResponse x
Prelude.Generic)
newGetMapTileResponse ::
Prelude.Int ->
GetMapTileResponse
newGetMapTileResponse :: Int -> GetMapTileResponse
newGetMapTileResponse Int
pHttpStatus_ =
GetMapTileResponse' :: Maybe ByteString -> Maybe Text -> Int -> GetMapTileResponse
GetMapTileResponse'
{ $sel:blob:GetMapTileResponse' :: Maybe ByteString
blob = Maybe ByteString
forall a. Maybe a
Prelude.Nothing,
$sel:contentType:GetMapTileResponse' :: Maybe Text
contentType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMapTileResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMapTileResponse_blob :: Lens.Lens' GetMapTileResponse (Prelude.Maybe Prelude.ByteString)
getMapTileResponse_blob :: (Maybe ByteString -> f (Maybe ByteString))
-> GetMapTileResponse -> f GetMapTileResponse
getMapTileResponse_blob = (GetMapTileResponse -> Maybe ByteString)
-> (GetMapTileResponse -> Maybe ByteString -> GetMapTileResponse)
-> Lens
GetMapTileResponse
GetMapTileResponse
(Maybe ByteString)
(Maybe ByteString)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMapTileResponse' {Maybe ByteString
blob :: Maybe ByteString
$sel:blob:GetMapTileResponse' :: GetMapTileResponse -> Maybe ByteString
blob} -> Maybe ByteString
blob) (\s :: GetMapTileResponse
s@GetMapTileResponse' {} Maybe ByteString
a -> GetMapTileResponse
s {$sel:blob:GetMapTileResponse' :: Maybe ByteString
blob = Maybe ByteString
a} :: GetMapTileResponse)
getMapTileResponse_contentType :: Lens.Lens' GetMapTileResponse (Prelude.Maybe Prelude.Text)
getMapTileResponse_contentType :: (Maybe Text -> f (Maybe Text))
-> GetMapTileResponse -> f GetMapTileResponse
getMapTileResponse_contentType = (GetMapTileResponse -> Maybe Text)
-> (GetMapTileResponse -> Maybe Text -> GetMapTileResponse)
-> Lens
GetMapTileResponse GetMapTileResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMapTileResponse' {Maybe Text
contentType :: Maybe Text
$sel:contentType:GetMapTileResponse' :: GetMapTileResponse -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: GetMapTileResponse
s@GetMapTileResponse' {} Maybe Text
a -> GetMapTileResponse
s {$sel:contentType:GetMapTileResponse' :: Maybe Text
contentType = Maybe Text
a} :: GetMapTileResponse)
getMapTileResponse_httpStatus :: Lens.Lens' GetMapTileResponse Prelude.Int
getMapTileResponse_httpStatus :: (Int -> f Int) -> GetMapTileResponse -> f GetMapTileResponse
getMapTileResponse_httpStatus = (GetMapTileResponse -> Int)
-> (GetMapTileResponse -> Int -> GetMapTileResponse)
-> Lens GetMapTileResponse GetMapTileResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMapTileResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMapTileResponse' :: GetMapTileResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMapTileResponse
s@GetMapTileResponse' {} Int
a -> GetMapTileResponse
s {$sel:httpStatus:GetMapTileResponse' :: Int
httpStatus = Int
a} :: GetMapTileResponse)
instance Prelude.NFData GetMapTileResponse