{-# 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.ListTrackers
(
ListTrackers (..),
newListTrackers,
listTrackers_nextToken,
listTrackers_maxResults,
ListTrackersResponse (..),
newListTrackersResponse,
listTrackersResponse_nextToken,
listTrackersResponse_httpStatus,
listTrackersResponse_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 ListTrackers = ListTrackers'
{
ListTrackers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTrackers -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListTrackers -> ListTrackers -> Bool
(ListTrackers -> ListTrackers -> Bool)
-> (ListTrackers -> ListTrackers -> Bool) -> Eq ListTrackers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTrackers -> ListTrackers -> Bool
$c/= :: ListTrackers -> ListTrackers -> Bool
== :: ListTrackers -> ListTrackers -> Bool
$c== :: ListTrackers -> ListTrackers -> Bool
Prelude.Eq, ReadPrec [ListTrackers]
ReadPrec ListTrackers
Int -> ReadS ListTrackers
ReadS [ListTrackers]
(Int -> ReadS ListTrackers)
-> ReadS [ListTrackers]
-> ReadPrec ListTrackers
-> ReadPrec [ListTrackers]
-> Read ListTrackers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTrackers]
$creadListPrec :: ReadPrec [ListTrackers]
readPrec :: ReadPrec ListTrackers
$creadPrec :: ReadPrec ListTrackers
readList :: ReadS [ListTrackers]
$creadList :: ReadS [ListTrackers]
readsPrec :: Int -> ReadS ListTrackers
$creadsPrec :: Int -> ReadS ListTrackers
Prelude.Read, Int -> ListTrackers -> ShowS
[ListTrackers] -> ShowS
ListTrackers -> String
(Int -> ListTrackers -> ShowS)
-> (ListTrackers -> String)
-> ([ListTrackers] -> ShowS)
-> Show ListTrackers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTrackers] -> ShowS
$cshowList :: [ListTrackers] -> ShowS
show :: ListTrackers -> String
$cshow :: ListTrackers -> String
showsPrec :: Int -> ListTrackers -> ShowS
$cshowsPrec :: Int -> ListTrackers -> ShowS
Prelude.Show, (forall x. ListTrackers -> Rep ListTrackers x)
-> (forall x. Rep ListTrackers x -> ListTrackers)
-> Generic ListTrackers
forall x. Rep ListTrackers x -> ListTrackers
forall x. ListTrackers -> Rep ListTrackers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTrackers x -> ListTrackers
$cfrom :: forall x. ListTrackers -> Rep ListTrackers x
Prelude.Generic)
newListTrackers ::
ListTrackers
newListTrackers :: ListTrackers
newListTrackers =
ListTrackers' :: Maybe Text -> Maybe Natural -> ListTrackers
ListTrackers'
{ $sel:nextToken:ListTrackers' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListTrackers' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listTrackers_nextToken :: Lens.Lens' ListTrackers (Prelude.Maybe Prelude.Text)
listTrackers_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListTrackers -> f ListTrackers
listTrackers_nextToken = (ListTrackers -> Maybe Text)
-> (ListTrackers -> Maybe Text -> ListTrackers)
-> Lens ListTrackers ListTrackers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrackers' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTrackers' :: ListTrackers -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTrackers
s@ListTrackers' {} Maybe Text
a -> ListTrackers
s {$sel:nextToken:ListTrackers' :: Maybe Text
nextToken = Maybe Text
a} :: ListTrackers)
listTrackers_maxResults :: Lens.Lens' ListTrackers (Prelude.Maybe Prelude.Natural)
listTrackers_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListTrackers -> f ListTrackers
listTrackers_maxResults = (ListTrackers -> Maybe Natural)
-> (ListTrackers -> Maybe Natural -> ListTrackers)
-> Lens ListTrackers ListTrackers (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrackers' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListTrackers' :: ListTrackers -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListTrackers
s@ListTrackers' {} Maybe Natural
a -> ListTrackers
s {$sel:maxResults:ListTrackers' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListTrackers)
instance Core.AWSPager ListTrackers where
page :: ListTrackers -> AWSResponse ListTrackers -> Maybe ListTrackers
page ListTrackers
rq AWSResponse ListTrackers
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListTrackers
ListTrackersResponse
rs
ListTrackersResponse
-> Getting (First Text) ListTrackersResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTrackersResponse -> Const (First Text) ListTrackersResponse
Lens' ListTrackersResponse (Maybe Text)
listTrackersResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListTrackersResponse -> Const (First Text) ListTrackersResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTrackersResponse 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 ListTrackers
forall a. Maybe a
Prelude.Nothing
| [ListTrackersResponseEntry] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse ListTrackers
ListTrackersResponse
rs ListTrackersResponse
-> Getting
[ListTrackersResponseEntry]
ListTrackersResponse
[ListTrackersResponseEntry]
-> [ListTrackersResponseEntry]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
[ListTrackersResponseEntry]
ListTrackersResponse
[ListTrackersResponseEntry]
Lens' ListTrackersResponse [ListTrackersResponseEntry]
listTrackersResponse_entries) =
Maybe ListTrackers
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListTrackers -> Maybe ListTrackers
forall a. a -> Maybe a
Prelude.Just (ListTrackers -> Maybe ListTrackers)
-> ListTrackers -> Maybe ListTrackers
forall a b. (a -> b) -> a -> b
Prelude.$
ListTrackers
rq
ListTrackers -> (ListTrackers -> ListTrackers) -> ListTrackers
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListTrackers -> Identity ListTrackers
Lens ListTrackers ListTrackers (Maybe Text) (Maybe Text)
listTrackers_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListTrackers -> Identity ListTrackers)
-> Maybe Text -> ListTrackers -> ListTrackers
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListTrackers
ListTrackersResponse
rs
ListTrackersResponse
-> Getting (First Text) ListTrackersResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListTrackersResponse -> Const (First Text) ListTrackersResponse
Lens' ListTrackersResponse (Maybe Text)
listTrackersResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListTrackersResponse -> Const (First Text) ListTrackersResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListTrackersResponse 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 ListTrackers where
type AWSResponse ListTrackers = ListTrackersResponse
request :: ListTrackers -> Request ListTrackers
request = Service -> ListTrackers -> Request ListTrackers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListTrackers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTrackers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListTrackers))
-> Logger
-> Service
-> Proxy ListTrackers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTrackers)))
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 -> [ListTrackersResponseEntry] -> ListTrackersResponse
ListTrackersResponse'
(Maybe Text
-> Int -> [ListTrackersResponseEntry] -> ListTrackersResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [ListTrackersResponseEntry] -> ListTrackersResponse)
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 -> [ListTrackersResponseEntry] -> ListTrackersResponse)
-> Either String Int
-> Either
String ([ListTrackersResponseEntry] -> ListTrackersResponse)
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 ([ListTrackersResponseEntry] -> ListTrackersResponse)
-> Either String [ListTrackersResponseEntry]
-> Either String ListTrackersResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [ListTrackersResponseEntry])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Entries" Either String (Maybe [ListTrackersResponseEntry])
-> [ListTrackersResponseEntry]
-> Either String [ListTrackersResponseEntry]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ListTrackersResponseEntry]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListTrackers
instance Prelude.NFData ListTrackers
instance Core.ToHeaders ListTrackers where
toHeaders :: ListTrackers -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListTrackers -> 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 ListTrackers where
toJSON :: ListTrackers -> Value
toJSON ListTrackers' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListTrackers' :: ListTrackers -> Maybe Natural
$sel:nextToken:ListTrackers' :: ListTrackers -> 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 ListTrackers where
toPath :: ListTrackers -> ByteString
toPath = ByteString -> ListTrackers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/tracking/v0/list-trackers"
instance Core.ToQuery ListTrackers where
toQuery :: ListTrackers -> QueryString
toQuery = QueryString -> ListTrackers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListTrackersResponse = ListTrackersResponse'
{
ListTrackersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListTrackersResponse -> Int
httpStatus :: Prelude.Int,
ListTrackersResponse -> [ListTrackersResponseEntry]
entries :: [ListTrackersResponseEntry]
}
deriving (ListTrackersResponse -> ListTrackersResponse -> Bool
(ListTrackersResponse -> ListTrackersResponse -> Bool)
-> (ListTrackersResponse -> ListTrackersResponse -> Bool)
-> Eq ListTrackersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTrackersResponse -> ListTrackersResponse -> Bool
$c/= :: ListTrackersResponse -> ListTrackersResponse -> Bool
== :: ListTrackersResponse -> ListTrackersResponse -> Bool
$c== :: ListTrackersResponse -> ListTrackersResponse -> Bool
Prelude.Eq, ReadPrec [ListTrackersResponse]
ReadPrec ListTrackersResponse
Int -> ReadS ListTrackersResponse
ReadS [ListTrackersResponse]
(Int -> ReadS ListTrackersResponse)
-> ReadS [ListTrackersResponse]
-> ReadPrec ListTrackersResponse
-> ReadPrec [ListTrackersResponse]
-> Read ListTrackersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTrackersResponse]
$creadListPrec :: ReadPrec [ListTrackersResponse]
readPrec :: ReadPrec ListTrackersResponse
$creadPrec :: ReadPrec ListTrackersResponse
readList :: ReadS [ListTrackersResponse]
$creadList :: ReadS [ListTrackersResponse]
readsPrec :: Int -> ReadS ListTrackersResponse
$creadsPrec :: Int -> ReadS ListTrackersResponse
Prelude.Read, Int -> ListTrackersResponse -> ShowS
[ListTrackersResponse] -> ShowS
ListTrackersResponse -> String
(Int -> ListTrackersResponse -> ShowS)
-> (ListTrackersResponse -> String)
-> ([ListTrackersResponse] -> ShowS)
-> Show ListTrackersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTrackersResponse] -> ShowS
$cshowList :: [ListTrackersResponse] -> ShowS
show :: ListTrackersResponse -> String
$cshow :: ListTrackersResponse -> String
showsPrec :: Int -> ListTrackersResponse -> ShowS
$cshowsPrec :: Int -> ListTrackersResponse -> ShowS
Prelude.Show, (forall x. ListTrackersResponse -> Rep ListTrackersResponse x)
-> (forall x. Rep ListTrackersResponse x -> ListTrackersResponse)
-> Generic ListTrackersResponse
forall x. Rep ListTrackersResponse x -> ListTrackersResponse
forall x. ListTrackersResponse -> Rep ListTrackersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTrackersResponse x -> ListTrackersResponse
$cfrom :: forall x. ListTrackersResponse -> Rep ListTrackersResponse x
Prelude.Generic)
newListTrackersResponse ::
Prelude.Int ->
ListTrackersResponse
newListTrackersResponse :: Int -> ListTrackersResponse
newListTrackersResponse Int
pHttpStatus_ =
ListTrackersResponse' :: Maybe Text
-> Int -> [ListTrackersResponseEntry] -> ListTrackersResponse
ListTrackersResponse'
{ $sel:nextToken:ListTrackersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListTrackersResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:entries:ListTrackersResponse' :: [ListTrackersResponseEntry]
entries = [ListTrackersResponseEntry]
forall a. Monoid a => a
Prelude.mempty
}
listTrackersResponse_nextToken :: Lens.Lens' ListTrackersResponse (Prelude.Maybe Prelude.Text)
listTrackersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListTrackersResponse -> f ListTrackersResponse
listTrackersResponse_nextToken = (ListTrackersResponse -> Maybe Text)
-> (ListTrackersResponse -> Maybe Text -> ListTrackersResponse)
-> Lens' ListTrackersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrackersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListTrackersResponse' :: ListTrackersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListTrackersResponse
s@ListTrackersResponse' {} Maybe Text
a -> ListTrackersResponse
s {$sel:nextToken:ListTrackersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListTrackersResponse)
listTrackersResponse_httpStatus :: Lens.Lens' ListTrackersResponse Prelude.Int
listTrackersResponse_httpStatus :: (Int -> f Int) -> ListTrackersResponse -> f ListTrackersResponse
listTrackersResponse_httpStatus = (ListTrackersResponse -> Int)
-> (ListTrackersResponse -> Int -> ListTrackersResponse)
-> Lens ListTrackersResponse ListTrackersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrackersResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListTrackersResponse' :: ListTrackersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListTrackersResponse
s@ListTrackersResponse' {} Int
a -> ListTrackersResponse
s {$sel:httpStatus:ListTrackersResponse' :: Int
httpStatus = Int
a} :: ListTrackersResponse)
listTrackersResponse_entries :: Lens.Lens' ListTrackersResponse [ListTrackersResponseEntry]
listTrackersResponse_entries :: ([ListTrackersResponseEntry] -> f [ListTrackersResponseEntry])
-> ListTrackersResponse -> f ListTrackersResponse
listTrackersResponse_entries = (ListTrackersResponse -> [ListTrackersResponseEntry])
-> (ListTrackersResponse
-> [ListTrackersResponseEntry] -> ListTrackersResponse)
-> Lens' ListTrackersResponse [ListTrackersResponseEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTrackersResponse' {[ListTrackersResponseEntry]
entries :: [ListTrackersResponseEntry]
$sel:entries:ListTrackersResponse' :: ListTrackersResponse -> [ListTrackersResponseEntry]
entries} -> [ListTrackersResponseEntry]
entries) (\s :: ListTrackersResponse
s@ListTrackersResponse' {} [ListTrackersResponseEntry]
a -> ListTrackersResponse
s {$sel:entries:ListTrackersResponse' :: [ListTrackersResponseEntry]
entries = [ListTrackersResponseEntry]
a} :: ListTrackersResponse) (([ListTrackersResponseEntry] -> f [ListTrackersResponseEntry])
-> ListTrackersResponse -> f ListTrackersResponse)
-> (([ListTrackersResponseEntry] -> f [ListTrackersResponseEntry])
-> [ListTrackersResponseEntry] -> f [ListTrackersResponseEntry])
-> ([ListTrackersResponseEntry] -> f [ListTrackersResponseEntry])
-> ListTrackersResponse
-> f ListTrackersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ListTrackersResponseEntry] -> f [ListTrackersResponseEntry])
-> [ListTrackersResponseEntry] -> f [ListTrackersResponseEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListTrackersResponse