{-# 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.ListMaps
(
ListMaps (..),
newListMaps,
listMaps_nextToken,
listMaps_maxResults,
ListMapsResponse (..),
newListMapsResponse,
listMapsResponse_nextToken,
listMapsResponse_httpStatus,
listMapsResponse_entries,
)
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 ListMaps = ListMaps'
{
ListMaps -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMaps -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListMaps -> ListMaps -> Bool
(ListMaps -> ListMaps -> Bool)
-> (ListMaps -> ListMaps -> Bool) -> Eq ListMaps
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMaps -> ListMaps -> Bool
$c/= :: ListMaps -> ListMaps -> Bool
== :: ListMaps -> ListMaps -> Bool
$c== :: ListMaps -> ListMaps -> Bool
Prelude.Eq, ReadPrec [ListMaps]
ReadPrec ListMaps
Int -> ReadS ListMaps
ReadS [ListMaps]
(Int -> ReadS ListMaps)
-> ReadS [ListMaps]
-> ReadPrec ListMaps
-> ReadPrec [ListMaps]
-> Read ListMaps
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMaps]
$creadListPrec :: ReadPrec [ListMaps]
readPrec :: ReadPrec ListMaps
$creadPrec :: ReadPrec ListMaps
readList :: ReadS [ListMaps]
$creadList :: ReadS [ListMaps]
readsPrec :: Int -> ReadS ListMaps
$creadsPrec :: Int -> ReadS ListMaps
Prelude.Read, Int -> ListMaps -> ShowS
[ListMaps] -> ShowS
ListMaps -> String
(Int -> ListMaps -> ShowS)
-> (ListMaps -> String) -> ([ListMaps] -> ShowS) -> Show ListMaps
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMaps] -> ShowS
$cshowList :: [ListMaps] -> ShowS
show :: ListMaps -> String
$cshow :: ListMaps -> String
showsPrec :: Int -> ListMaps -> ShowS
$cshowsPrec :: Int -> ListMaps -> ShowS
Prelude.Show, (forall x. ListMaps -> Rep ListMaps x)
-> (forall x. Rep ListMaps x -> ListMaps) -> Generic ListMaps
forall x. Rep ListMaps x -> ListMaps
forall x. ListMaps -> Rep ListMaps x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMaps x -> ListMaps
$cfrom :: forall x. ListMaps -> Rep ListMaps x
Prelude.Generic)
newListMaps ::
ListMaps
newListMaps :: ListMaps
newListMaps =
ListMaps' :: Maybe Text -> Maybe Natural -> ListMaps
ListMaps'
{ $sel:nextToken:ListMaps' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListMaps' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listMaps_nextToken :: Lens.Lens' ListMaps (Prelude.Maybe Prelude.Text)
listMaps_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListMaps -> f ListMaps
listMaps_nextToken = (ListMaps -> Maybe Text)
-> (ListMaps -> Maybe Text -> ListMaps)
-> Lens ListMaps ListMaps (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMaps' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMaps' :: ListMaps -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMaps
s@ListMaps' {} Maybe Text
a -> ListMaps
s {$sel:nextToken:ListMaps' :: Maybe Text
nextToken = Maybe Text
a} :: ListMaps)
listMaps_maxResults :: Lens.Lens' ListMaps (Prelude.Maybe Prelude.Natural)
listMaps_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListMaps -> f ListMaps
listMaps_maxResults = (ListMaps -> Maybe Natural)
-> (ListMaps -> Maybe Natural -> ListMaps)
-> Lens ListMaps ListMaps (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMaps' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMaps' :: ListMaps -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMaps
s@ListMaps' {} Maybe Natural
a -> ListMaps
s {$sel:maxResults:ListMaps' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMaps)
instance Core.AWSPager ListMaps where
page :: ListMaps -> AWSResponse ListMaps -> Maybe ListMaps
page ListMaps
rq AWSResponse ListMaps
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListMaps
ListMapsResponse
rs
ListMapsResponse
-> Getting (First Text) ListMapsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListMapsResponse -> Const (First Text) ListMapsResponse
Lens' ListMapsResponse (Maybe Text)
listMapsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListMapsResponse -> Const (First Text) ListMapsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListMapsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListMaps
forall a. Maybe a
Prelude.Nothing
| [ListMapsResponseEntry] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse ListMaps
ListMapsResponse
rs ListMapsResponse
-> Getting
[ListMapsResponseEntry] ListMapsResponse [ListMapsResponseEntry]
-> [ListMapsResponseEntry]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
[ListMapsResponseEntry] ListMapsResponse [ListMapsResponseEntry]
Lens' ListMapsResponse [ListMapsResponseEntry]
listMapsResponse_entries) =
Maybe ListMaps
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListMaps -> Maybe ListMaps
forall a. a -> Maybe a
Prelude.Just (ListMaps -> Maybe ListMaps) -> ListMaps -> Maybe ListMaps
forall a b. (a -> b) -> a -> b
Prelude.$
ListMaps
rq
ListMaps -> (ListMaps -> ListMaps) -> ListMaps
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListMaps -> Identity ListMaps
Lens ListMaps ListMaps (Maybe Text) (Maybe Text)
listMaps_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListMaps -> Identity ListMaps)
-> Maybe Text -> ListMaps -> ListMaps
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListMaps
ListMapsResponse
rs
ListMapsResponse
-> Getting (First Text) ListMapsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListMapsResponse -> Const (First Text) ListMapsResponse
Lens' ListMapsResponse (Maybe Text)
listMapsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListMapsResponse -> Const (First Text) ListMapsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListMapsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListMaps where
type AWSResponse ListMaps = ListMapsResponse
request :: ListMaps -> Request ListMaps
request = Service -> ListMaps -> Request ListMaps
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListMaps
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMaps)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListMaps))
-> Logger
-> Service
-> Proxy ListMaps
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMaps)))
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 Text -> Int -> [ListMapsResponseEntry] -> ListMapsResponse
ListMapsResponse'
(Maybe Text -> Int -> [ListMapsResponseEntry] -> ListMapsResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [ListMapsResponseEntry] -> ListMapsResponse)
forall (f :: * -> *) a b. Functor 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
"NextToken")
Either String (Int -> [ListMapsResponseEntry] -> ListMapsResponse)
-> Either String Int
-> Either String ([ListMapsResponseEntry] -> ListMapsResponse)
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))
Either String ([ListMapsResponseEntry] -> ListMapsResponse)
-> Either String [ListMapsResponseEntry]
-> Either String ListMapsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [ListMapsResponseEntry])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Entries" Either String (Maybe [ListMapsResponseEntry])
-> [ListMapsResponseEntry] -> Either String [ListMapsResponseEntry]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ListMapsResponseEntry]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListMaps
instance Prelude.NFData ListMaps
instance Core.ToHeaders ListMaps where
toHeaders :: ListMaps -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListMaps -> 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.ToJSON ListMaps where
toJSON :: ListMaps -> Value
toJSON ListMaps' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListMaps' :: ListMaps -> Maybe Natural
$sel:nextToken:ListMaps' :: ListMaps -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath ListMaps where
toPath :: ListMaps -> ByteString
toPath = ByteString -> ListMaps -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/maps/v0/list-maps"
instance Core.ToQuery ListMaps where
toQuery :: ListMaps -> QueryString
toQuery = QueryString -> ListMaps -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListMapsResponse = ListMapsResponse'
{
ListMapsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMapsResponse -> Int
httpStatus :: Prelude.Int,
ListMapsResponse -> [ListMapsResponseEntry]
entries :: [ListMapsResponseEntry]
}
deriving (ListMapsResponse -> ListMapsResponse -> Bool
(ListMapsResponse -> ListMapsResponse -> Bool)
-> (ListMapsResponse -> ListMapsResponse -> Bool)
-> Eq ListMapsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMapsResponse -> ListMapsResponse -> Bool
$c/= :: ListMapsResponse -> ListMapsResponse -> Bool
== :: ListMapsResponse -> ListMapsResponse -> Bool
$c== :: ListMapsResponse -> ListMapsResponse -> Bool
Prelude.Eq, ReadPrec [ListMapsResponse]
ReadPrec ListMapsResponse
Int -> ReadS ListMapsResponse
ReadS [ListMapsResponse]
(Int -> ReadS ListMapsResponse)
-> ReadS [ListMapsResponse]
-> ReadPrec ListMapsResponse
-> ReadPrec [ListMapsResponse]
-> Read ListMapsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMapsResponse]
$creadListPrec :: ReadPrec [ListMapsResponse]
readPrec :: ReadPrec ListMapsResponse
$creadPrec :: ReadPrec ListMapsResponse
readList :: ReadS [ListMapsResponse]
$creadList :: ReadS [ListMapsResponse]
readsPrec :: Int -> ReadS ListMapsResponse
$creadsPrec :: Int -> ReadS ListMapsResponse
Prelude.Read, Int -> ListMapsResponse -> ShowS
[ListMapsResponse] -> ShowS
ListMapsResponse -> String
(Int -> ListMapsResponse -> ShowS)
-> (ListMapsResponse -> String)
-> ([ListMapsResponse] -> ShowS)
-> Show ListMapsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMapsResponse] -> ShowS
$cshowList :: [ListMapsResponse] -> ShowS
show :: ListMapsResponse -> String
$cshow :: ListMapsResponse -> String
showsPrec :: Int -> ListMapsResponse -> ShowS
$cshowsPrec :: Int -> ListMapsResponse -> ShowS
Prelude.Show, (forall x. ListMapsResponse -> Rep ListMapsResponse x)
-> (forall x. Rep ListMapsResponse x -> ListMapsResponse)
-> Generic ListMapsResponse
forall x. Rep ListMapsResponse x -> ListMapsResponse
forall x. ListMapsResponse -> Rep ListMapsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMapsResponse x -> ListMapsResponse
$cfrom :: forall x. ListMapsResponse -> Rep ListMapsResponse x
Prelude.Generic)
newListMapsResponse ::
Prelude.Int ->
ListMapsResponse
newListMapsResponse :: Int -> ListMapsResponse
newListMapsResponse Int
pHttpStatus_ =
ListMapsResponse' :: Maybe Text -> Int -> [ListMapsResponseEntry] -> ListMapsResponse
ListMapsResponse'
{ $sel:nextToken:ListMapsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListMapsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:entries:ListMapsResponse' :: [ListMapsResponseEntry]
entries = [ListMapsResponseEntry]
forall a. Monoid a => a
Prelude.mempty
}
listMapsResponse_nextToken :: Lens.Lens' ListMapsResponse (Prelude.Maybe Prelude.Text)
listMapsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMapsResponse -> f ListMapsResponse
listMapsResponse_nextToken = (ListMapsResponse -> Maybe Text)
-> (ListMapsResponse -> Maybe Text -> ListMapsResponse)
-> Lens' ListMapsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMapsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMapsResponse' :: ListMapsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMapsResponse
s@ListMapsResponse' {} Maybe Text
a -> ListMapsResponse
s {$sel:nextToken:ListMapsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMapsResponse)
listMapsResponse_httpStatus :: Lens.Lens' ListMapsResponse Prelude.Int
listMapsResponse_httpStatus :: (Int -> f Int) -> ListMapsResponse -> f ListMapsResponse
listMapsResponse_httpStatus = (ListMapsResponse -> Int)
-> (ListMapsResponse -> Int -> ListMapsResponse)
-> Lens ListMapsResponse ListMapsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMapsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListMapsResponse' :: ListMapsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListMapsResponse
s@ListMapsResponse' {} Int
a -> ListMapsResponse
s {$sel:httpStatus:ListMapsResponse' :: Int
httpStatus = Int
a} :: ListMapsResponse)
listMapsResponse_entries :: Lens.Lens' ListMapsResponse [ListMapsResponseEntry]
listMapsResponse_entries :: ([ListMapsResponseEntry] -> f [ListMapsResponseEntry])
-> ListMapsResponse -> f ListMapsResponse
listMapsResponse_entries = (ListMapsResponse -> [ListMapsResponseEntry])
-> (ListMapsResponse
-> [ListMapsResponseEntry] -> ListMapsResponse)
-> Lens' ListMapsResponse [ListMapsResponseEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMapsResponse' {[ListMapsResponseEntry]
entries :: [ListMapsResponseEntry]
$sel:entries:ListMapsResponse' :: ListMapsResponse -> [ListMapsResponseEntry]
entries} -> [ListMapsResponseEntry]
entries) (\s :: ListMapsResponse
s@ListMapsResponse' {} [ListMapsResponseEntry]
a -> ListMapsResponse
s {$sel:entries:ListMapsResponse' :: [ListMapsResponseEntry]
entries = [ListMapsResponseEntry]
a} :: ListMapsResponse) (([ListMapsResponseEntry] -> f [ListMapsResponseEntry])
-> ListMapsResponse -> f ListMapsResponse)
-> (([ListMapsResponseEntry] -> f [ListMapsResponseEntry])
-> [ListMapsResponseEntry] -> f [ListMapsResponseEntry])
-> ([ListMapsResponseEntry] -> f [ListMapsResponseEntry])
-> ListMapsResponse
-> f ListMapsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ListMapsResponseEntry] -> f [ListMapsResponseEntry])
-> [ListMapsResponseEntry] -> f [ListMapsResponseEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListMapsResponse