{-# 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.ListDevicePositions
(
ListDevicePositions (..),
newListDevicePositions,
listDevicePositions_maxResults,
listDevicePositions_nextToken,
listDevicePositions_trackerName,
ListDevicePositionsResponse (..),
newListDevicePositionsResponse,
listDevicePositionsResponse_nextToken,
listDevicePositionsResponse_httpStatus,
listDevicePositionsResponse_entries,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Location.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListDevicePositions = ListDevicePositions'
{
ListDevicePositions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListDevicePositions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDevicePositions -> Text
trackerName :: Prelude.Text
}
deriving (ListDevicePositions -> ListDevicePositions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDevicePositions -> ListDevicePositions -> Bool
$c/= :: ListDevicePositions -> ListDevicePositions -> Bool
== :: ListDevicePositions -> ListDevicePositions -> Bool
$c== :: ListDevicePositions -> ListDevicePositions -> Bool
Prelude.Eq, ReadPrec [ListDevicePositions]
ReadPrec ListDevicePositions
Int -> ReadS ListDevicePositions
ReadS [ListDevicePositions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDevicePositions]
$creadListPrec :: ReadPrec [ListDevicePositions]
readPrec :: ReadPrec ListDevicePositions
$creadPrec :: ReadPrec ListDevicePositions
readList :: ReadS [ListDevicePositions]
$creadList :: ReadS [ListDevicePositions]
readsPrec :: Int -> ReadS ListDevicePositions
$creadsPrec :: Int -> ReadS ListDevicePositions
Prelude.Read, Int -> ListDevicePositions -> ShowS
[ListDevicePositions] -> ShowS
ListDevicePositions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDevicePositions] -> ShowS
$cshowList :: [ListDevicePositions] -> ShowS
show :: ListDevicePositions -> String
$cshow :: ListDevicePositions -> String
showsPrec :: Int -> ListDevicePositions -> ShowS
$cshowsPrec :: Int -> ListDevicePositions -> ShowS
Prelude.Show, forall x. Rep ListDevicePositions x -> ListDevicePositions
forall x. ListDevicePositions -> Rep ListDevicePositions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDevicePositions x -> ListDevicePositions
$cfrom :: forall x. ListDevicePositions -> Rep ListDevicePositions x
Prelude.Generic)
newListDevicePositions ::
Prelude.Text ->
ListDevicePositions
newListDevicePositions :: Text -> ListDevicePositions
newListDevicePositions Text
pTrackerName_ =
ListDevicePositions'
{ $sel:maxResults:ListDevicePositions' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDevicePositions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:trackerName:ListDevicePositions' :: Text
trackerName = Text
pTrackerName_
}
listDevicePositions_maxResults :: Lens.Lens' ListDevicePositions (Prelude.Maybe Prelude.Natural)
listDevicePositions_maxResults :: Lens' ListDevicePositions (Maybe Natural)
listDevicePositions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDevicePositions' :: ListDevicePositions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDevicePositions
s@ListDevicePositions' {} Maybe Natural
a -> ListDevicePositions
s {$sel:maxResults:ListDevicePositions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDevicePositions)
listDevicePositions_nextToken :: Lens.Lens' ListDevicePositions (Prelude.Maybe Prelude.Text)
listDevicePositions_nextToken :: Lens' ListDevicePositions (Maybe Text)
listDevicePositions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDevicePositions' :: ListDevicePositions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDevicePositions
s@ListDevicePositions' {} Maybe Text
a -> ListDevicePositions
s {$sel:nextToken:ListDevicePositions' :: Maybe Text
nextToken = Maybe Text
a} :: ListDevicePositions)
listDevicePositions_trackerName :: Lens.Lens' ListDevicePositions Prelude.Text
listDevicePositions_trackerName :: Lens' ListDevicePositions Text
listDevicePositions_trackerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositions' {Text
trackerName :: Text
$sel:trackerName:ListDevicePositions' :: ListDevicePositions -> Text
trackerName} -> Text
trackerName) (\s :: ListDevicePositions
s@ListDevicePositions' {} Text
a -> ListDevicePositions
s {$sel:trackerName:ListDevicePositions' :: Text
trackerName = Text
a} :: ListDevicePositions)
instance Core.AWSPager ListDevicePositions where
page :: ListDevicePositions
-> AWSResponse ListDevicePositions -> Maybe ListDevicePositions
page ListDevicePositions
rq AWSResponse ListDevicePositions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDevicePositions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDevicePositionsResponse (Maybe Text)
listDevicePositionsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListDevicePositions
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens'
ListDevicePositionsResponse [ListDevicePositionsResponseEntry]
listDevicePositionsResponse_entries) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListDevicePositions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDevicePositions (Maybe Text)
listDevicePositions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDevicePositions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDevicePositionsResponse (Maybe Text)
listDevicePositionsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListDevicePositions where
type
AWSResponse ListDevicePositions =
ListDevicePositionsResponse
request :: (Service -> Service)
-> ListDevicePositions -> Request ListDevicePositions
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListDevicePositions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListDevicePositions)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Int
-> [ListDevicePositionsResponseEntry]
-> ListDevicePositionsResponse
ListDevicePositionsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Entries" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListDevicePositions where
hashWithSalt :: Int -> ListDevicePositions -> Int
hashWithSalt Int
_salt ListDevicePositions' {Maybe Natural
Maybe Text
Text
trackerName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:trackerName:ListDevicePositions' :: ListDevicePositions -> Text
$sel:nextToken:ListDevicePositions' :: ListDevicePositions -> Maybe Text
$sel:maxResults:ListDevicePositions' :: ListDevicePositions -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
trackerName
instance Prelude.NFData ListDevicePositions where
rnf :: ListDevicePositions -> ()
rnf ListDevicePositions' {Maybe Natural
Maybe Text
Text
trackerName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:trackerName:ListDevicePositions' :: ListDevicePositions -> Text
$sel:nextToken:ListDevicePositions' :: ListDevicePositions -> Maybe Text
$sel:maxResults:ListDevicePositions' :: ListDevicePositions -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
trackerName
instance Data.ToHeaders ListDevicePositions where
toHeaders :: ListDevicePositions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListDevicePositions where
toJSON :: ListDevicePositions -> Value
toJSON ListDevicePositions' {Maybe Natural
Maybe Text
Text
trackerName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:trackerName:ListDevicePositions' :: ListDevicePositions -> Text
$sel:nextToken:ListDevicePositions' :: ListDevicePositions -> Maybe Text
$sel:maxResults:ListDevicePositions' :: ListDevicePositions -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListDevicePositions where
toPath :: ListDevicePositions -> ByteString
toPath ListDevicePositions' {Maybe Natural
Maybe Text
Text
trackerName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:trackerName:ListDevicePositions' :: ListDevicePositions -> Text
$sel:nextToken:ListDevicePositions' :: ListDevicePositions -> Maybe Text
$sel:maxResults:ListDevicePositions' :: ListDevicePositions -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/tracking/v0/trackers/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
trackerName,
ByteString
"/list-positions"
]
instance Data.ToQuery ListDevicePositions where
toQuery :: ListDevicePositions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListDevicePositionsResponse = ListDevicePositionsResponse'
{
ListDevicePositionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDevicePositionsResponse -> Int
httpStatus :: Prelude.Int,
ListDevicePositionsResponse -> [ListDevicePositionsResponseEntry]
entries :: [ListDevicePositionsResponseEntry]
}
deriving (ListDevicePositionsResponse -> ListDevicePositionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDevicePositionsResponse -> ListDevicePositionsResponse -> Bool
$c/= :: ListDevicePositionsResponse -> ListDevicePositionsResponse -> Bool
== :: ListDevicePositionsResponse -> ListDevicePositionsResponse -> Bool
$c== :: ListDevicePositionsResponse -> ListDevicePositionsResponse -> Bool
Prelude.Eq, Int -> ListDevicePositionsResponse -> ShowS
[ListDevicePositionsResponse] -> ShowS
ListDevicePositionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDevicePositionsResponse] -> ShowS
$cshowList :: [ListDevicePositionsResponse] -> ShowS
show :: ListDevicePositionsResponse -> String
$cshow :: ListDevicePositionsResponse -> String
showsPrec :: Int -> ListDevicePositionsResponse -> ShowS
$cshowsPrec :: Int -> ListDevicePositionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListDevicePositionsResponse x -> ListDevicePositionsResponse
forall x.
ListDevicePositionsResponse -> Rep ListDevicePositionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDevicePositionsResponse x -> ListDevicePositionsResponse
$cfrom :: forall x.
ListDevicePositionsResponse -> Rep ListDevicePositionsResponse x
Prelude.Generic)
newListDevicePositionsResponse ::
Prelude.Int ->
ListDevicePositionsResponse
newListDevicePositionsResponse :: Int -> ListDevicePositionsResponse
newListDevicePositionsResponse Int
pHttpStatus_ =
ListDevicePositionsResponse'
{ $sel:nextToken:ListDevicePositionsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDevicePositionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:entries:ListDevicePositionsResponse' :: [ListDevicePositionsResponseEntry]
entries = forall a. Monoid a => a
Prelude.mempty
}
listDevicePositionsResponse_nextToken :: Lens.Lens' ListDevicePositionsResponse (Prelude.Maybe Prelude.Text)
listDevicePositionsResponse_nextToken :: Lens' ListDevicePositionsResponse (Maybe Text)
listDevicePositionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDevicePositionsResponse' :: ListDevicePositionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDevicePositionsResponse
s@ListDevicePositionsResponse' {} Maybe Text
a -> ListDevicePositionsResponse
s {$sel:nextToken:ListDevicePositionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDevicePositionsResponse)
listDevicePositionsResponse_httpStatus :: Lens.Lens' ListDevicePositionsResponse Prelude.Int
listDevicePositionsResponse_httpStatus :: Lens' ListDevicePositionsResponse Int
listDevicePositionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDevicePositionsResponse' :: ListDevicePositionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDevicePositionsResponse
s@ListDevicePositionsResponse' {} Int
a -> ListDevicePositionsResponse
s {$sel:httpStatus:ListDevicePositionsResponse' :: Int
httpStatus = Int
a} :: ListDevicePositionsResponse)
listDevicePositionsResponse_entries :: Lens.Lens' ListDevicePositionsResponse [ListDevicePositionsResponseEntry]
listDevicePositionsResponse_entries :: Lens'
ListDevicePositionsResponse [ListDevicePositionsResponseEntry]
listDevicePositionsResponse_entries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositionsResponse' {[ListDevicePositionsResponseEntry]
entries :: [ListDevicePositionsResponseEntry]
$sel:entries:ListDevicePositionsResponse' :: ListDevicePositionsResponse -> [ListDevicePositionsResponseEntry]
entries} -> [ListDevicePositionsResponseEntry]
entries) (\s :: ListDevicePositionsResponse
s@ListDevicePositionsResponse' {} [ListDevicePositionsResponseEntry]
a -> ListDevicePositionsResponse
s {$sel:entries:ListDevicePositionsResponse' :: [ListDevicePositionsResponseEntry]
entries = [ListDevicePositionsResponseEntry]
a} :: ListDevicePositionsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListDevicePositionsResponse where
rnf :: ListDevicePositionsResponse -> ()
rnf ListDevicePositionsResponse' {Int
[ListDevicePositionsResponseEntry]
Maybe Text
entries :: [ListDevicePositionsResponseEntry]
httpStatus :: Int
nextToken :: Maybe Text
$sel:entries:ListDevicePositionsResponse' :: ListDevicePositionsResponse -> [ListDevicePositionsResponseEntry]
$sel:httpStatus:ListDevicePositionsResponse' :: ListDevicePositionsResponse -> Int
$sel:nextToken:ListDevicePositionsResponse' :: ListDevicePositionsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ListDevicePositionsResponseEntry]
entries