{-# 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.ListGeofences
(
ListGeofences (..),
newListGeofences,
listGeofences_maxResults,
listGeofences_nextToken,
listGeofences_collectionName,
ListGeofencesResponse (..),
newListGeofencesResponse,
listGeofencesResponse_nextToken,
listGeofencesResponse_httpStatus,
listGeofencesResponse_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 ListGeofences = ListGeofences'
{
ListGeofences -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListGeofences -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListGeofences -> Text
collectionName :: Prelude.Text
}
deriving (ListGeofences -> ListGeofences -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGeofences -> ListGeofences -> Bool
$c/= :: ListGeofences -> ListGeofences -> Bool
== :: ListGeofences -> ListGeofences -> Bool
$c== :: ListGeofences -> ListGeofences -> Bool
Prelude.Eq, ReadPrec [ListGeofences]
ReadPrec ListGeofences
Int -> ReadS ListGeofences
ReadS [ListGeofences]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGeofences]
$creadListPrec :: ReadPrec [ListGeofences]
readPrec :: ReadPrec ListGeofences
$creadPrec :: ReadPrec ListGeofences
readList :: ReadS [ListGeofences]
$creadList :: ReadS [ListGeofences]
readsPrec :: Int -> ReadS ListGeofences
$creadsPrec :: Int -> ReadS ListGeofences
Prelude.Read, Int -> ListGeofences -> ShowS
[ListGeofences] -> ShowS
ListGeofences -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGeofences] -> ShowS
$cshowList :: [ListGeofences] -> ShowS
show :: ListGeofences -> String
$cshow :: ListGeofences -> String
showsPrec :: Int -> ListGeofences -> ShowS
$cshowsPrec :: Int -> ListGeofences -> ShowS
Prelude.Show, forall x. Rep ListGeofences x -> ListGeofences
forall x. ListGeofences -> Rep ListGeofences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGeofences x -> ListGeofences
$cfrom :: forall x. ListGeofences -> Rep ListGeofences x
Prelude.Generic)
newListGeofences ::
Prelude.Text ->
ListGeofences
newListGeofences :: Text -> ListGeofences
newListGeofences Text
pCollectionName_ =
ListGeofences'
{ $sel:maxResults:ListGeofences' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListGeofences' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:collectionName:ListGeofences' :: Text
collectionName = Text
pCollectionName_
}
listGeofences_maxResults :: Lens.Lens' ListGeofences (Prelude.Maybe Prelude.Natural)
listGeofences_maxResults :: Lens' ListGeofences (Maybe Natural)
listGeofences_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGeofences' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListGeofences' :: ListGeofences -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListGeofences
s@ListGeofences' {} Maybe Natural
a -> ListGeofences
s {$sel:maxResults:ListGeofences' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListGeofences)
listGeofences_nextToken :: Lens.Lens' ListGeofences (Prelude.Maybe Prelude.Text)
listGeofences_nextToken :: Lens' ListGeofences (Maybe Text)
listGeofences_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGeofences' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGeofences' :: ListGeofences -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGeofences
s@ListGeofences' {} Maybe Text
a -> ListGeofences
s {$sel:nextToken:ListGeofences' :: Maybe Text
nextToken = Maybe Text
a} :: ListGeofences)
listGeofences_collectionName :: Lens.Lens' ListGeofences Prelude.Text
listGeofences_collectionName :: Lens' ListGeofences Text
listGeofences_collectionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGeofences' {Text
collectionName :: Text
$sel:collectionName:ListGeofences' :: ListGeofences -> Text
collectionName} -> Text
collectionName) (\s :: ListGeofences
s@ListGeofences' {} Text
a -> ListGeofences
s {$sel:collectionName:ListGeofences' :: Text
collectionName = Text
a} :: ListGeofences)
instance Core.AWSPager ListGeofences where
page :: ListGeofences -> AWSResponse ListGeofences -> Maybe ListGeofences
page ListGeofences
rq AWSResponse ListGeofences
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListGeofences
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGeofencesResponse (Maybe Text)
listGeofencesResponse_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 ListGeofences
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListGeofencesResponse [ListGeofenceResponseEntry]
listGeofencesResponse_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.$ ListGeofences
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListGeofences (Maybe Text)
listGeofences_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListGeofences
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGeofencesResponse (Maybe Text)
listGeofencesResponse_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 ListGeofences where
type
AWSResponse ListGeofences =
ListGeofencesResponse
request :: (Service -> Service) -> ListGeofences -> Request ListGeofences
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 ListGeofences
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListGeofences)))
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 -> [ListGeofenceResponseEntry] -> ListGeofencesResponse
ListGeofencesResponse'
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 ListGeofences where
hashWithSalt :: Int -> ListGeofences -> Int
hashWithSalt Int
_salt ListGeofences' {Maybe Natural
Maybe Text
Text
collectionName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:collectionName:ListGeofences' :: ListGeofences -> Text
$sel:nextToken:ListGeofences' :: ListGeofences -> Maybe Text
$sel:maxResults:ListGeofences' :: ListGeofences -> 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
collectionName
instance Prelude.NFData ListGeofences where
rnf :: ListGeofences -> ()
rnf ListGeofences' {Maybe Natural
Maybe Text
Text
collectionName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:collectionName:ListGeofences' :: ListGeofences -> Text
$sel:nextToken:ListGeofences' :: ListGeofences -> Maybe Text
$sel:maxResults:ListGeofences' :: ListGeofences -> 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
collectionName
instance Data.ToHeaders ListGeofences where
toHeaders :: ListGeofences -> 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 ListGeofences where
toJSON :: ListGeofences -> Value
toJSON ListGeofences' {Maybe Natural
Maybe Text
Text
collectionName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:collectionName:ListGeofences' :: ListGeofences -> Text
$sel:nextToken:ListGeofences' :: ListGeofences -> Maybe Text
$sel:maxResults:ListGeofences' :: ListGeofences -> 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 ListGeofences where
toPath :: ListGeofences -> ByteString
toPath ListGeofences' {Maybe Natural
Maybe Text
Text
collectionName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:collectionName:ListGeofences' :: ListGeofences -> Text
$sel:nextToken:ListGeofences' :: ListGeofences -> Maybe Text
$sel:maxResults:ListGeofences' :: ListGeofences -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/geofencing/v0/collections/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
collectionName,
ByteString
"/list-geofences"
]
instance Data.ToQuery ListGeofences where
toQuery :: ListGeofences -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListGeofencesResponse = ListGeofencesResponse'
{
ListGeofencesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListGeofencesResponse -> Int
httpStatus :: Prelude.Int,
ListGeofencesResponse -> [ListGeofenceResponseEntry]
entries :: [ListGeofenceResponseEntry]
}
deriving (ListGeofencesResponse -> ListGeofencesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGeofencesResponse -> ListGeofencesResponse -> Bool
$c/= :: ListGeofencesResponse -> ListGeofencesResponse -> Bool
== :: ListGeofencesResponse -> ListGeofencesResponse -> Bool
$c== :: ListGeofencesResponse -> ListGeofencesResponse -> Bool
Prelude.Eq, Int -> ListGeofencesResponse -> ShowS
[ListGeofencesResponse] -> ShowS
ListGeofencesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGeofencesResponse] -> ShowS
$cshowList :: [ListGeofencesResponse] -> ShowS
show :: ListGeofencesResponse -> String
$cshow :: ListGeofencesResponse -> String
showsPrec :: Int -> ListGeofencesResponse -> ShowS
$cshowsPrec :: Int -> ListGeofencesResponse -> ShowS
Prelude.Show, forall x. Rep ListGeofencesResponse x -> ListGeofencesResponse
forall x. ListGeofencesResponse -> Rep ListGeofencesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGeofencesResponse x -> ListGeofencesResponse
$cfrom :: forall x. ListGeofencesResponse -> Rep ListGeofencesResponse x
Prelude.Generic)
newListGeofencesResponse ::
Prelude.Int ->
ListGeofencesResponse
newListGeofencesResponse :: Int -> ListGeofencesResponse
newListGeofencesResponse Int
pHttpStatus_ =
ListGeofencesResponse'
{ $sel:nextToken:ListGeofencesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListGeofencesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:entries:ListGeofencesResponse' :: [ListGeofenceResponseEntry]
entries = forall a. Monoid a => a
Prelude.mempty
}
listGeofencesResponse_nextToken :: Lens.Lens' ListGeofencesResponse (Prelude.Maybe Prelude.Text)
listGeofencesResponse_nextToken :: Lens' ListGeofencesResponse (Maybe Text)
listGeofencesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGeofencesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGeofencesResponse' :: ListGeofencesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGeofencesResponse
s@ListGeofencesResponse' {} Maybe Text
a -> ListGeofencesResponse
s {$sel:nextToken:ListGeofencesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListGeofencesResponse)
listGeofencesResponse_httpStatus :: Lens.Lens' ListGeofencesResponse Prelude.Int
listGeofencesResponse_httpStatus :: Lens' ListGeofencesResponse Int
listGeofencesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGeofencesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListGeofencesResponse' :: ListGeofencesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListGeofencesResponse
s@ListGeofencesResponse' {} Int
a -> ListGeofencesResponse
s {$sel:httpStatus:ListGeofencesResponse' :: Int
httpStatus = Int
a} :: ListGeofencesResponse)
listGeofencesResponse_entries :: Lens.Lens' ListGeofencesResponse [ListGeofenceResponseEntry]
listGeofencesResponse_entries :: Lens' ListGeofencesResponse [ListGeofenceResponseEntry]
listGeofencesResponse_entries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGeofencesResponse' {[ListGeofenceResponseEntry]
entries :: [ListGeofenceResponseEntry]
$sel:entries:ListGeofencesResponse' :: ListGeofencesResponse -> [ListGeofenceResponseEntry]
entries} -> [ListGeofenceResponseEntry]
entries) (\s :: ListGeofencesResponse
s@ListGeofencesResponse' {} [ListGeofenceResponseEntry]
a -> ListGeofencesResponse
s {$sel:entries:ListGeofencesResponse' :: [ListGeofenceResponseEntry]
entries = [ListGeofenceResponseEntry]
a} :: ListGeofencesResponse) 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 ListGeofencesResponse where
rnf :: ListGeofencesResponse -> ()
rnf ListGeofencesResponse' {Int
[ListGeofenceResponseEntry]
Maybe Text
entries :: [ListGeofenceResponseEntry]
httpStatus :: Int
nextToken :: Maybe Text
$sel:entries:ListGeofencesResponse' :: ListGeofencesResponse -> [ListGeofenceResponseEntry]
$sel:httpStatus:ListGeofencesResponse' :: ListGeofencesResponse -> Int
$sel:nextToken:ListGeofencesResponse' :: ListGeofencesResponse -> 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 [ListGeofenceResponseEntry]
entries