{-# 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.BatchEvaluateGeofences
(
BatchEvaluateGeofences (..),
newBatchEvaluateGeofences,
batchEvaluateGeofences_collectionName,
batchEvaluateGeofences_devicePositionUpdates,
BatchEvaluateGeofencesResponse (..),
newBatchEvaluateGeofencesResponse,
batchEvaluateGeofencesResponse_httpStatus,
batchEvaluateGeofencesResponse_errors,
)
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 BatchEvaluateGeofences = BatchEvaluateGeofences'
{
BatchEvaluateGeofences -> Text
collectionName :: Prelude.Text,
BatchEvaluateGeofences -> NonEmpty DevicePositionUpdate
devicePositionUpdates :: Prelude.NonEmpty DevicePositionUpdate
}
deriving (BatchEvaluateGeofences -> BatchEvaluateGeofences -> Bool
(BatchEvaluateGeofences -> BatchEvaluateGeofences -> Bool)
-> (BatchEvaluateGeofences -> BatchEvaluateGeofences -> Bool)
-> Eq BatchEvaluateGeofences
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchEvaluateGeofences -> BatchEvaluateGeofences -> Bool
$c/= :: BatchEvaluateGeofences -> BatchEvaluateGeofences -> Bool
== :: BatchEvaluateGeofences -> BatchEvaluateGeofences -> Bool
$c== :: BatchEvaluateGeofences -> BatchEvaluateGeofences -> Bool
Prelude.Eq, Int -> BatchEvaluateGeofences -> ShowS
[BatchEvaluateGeofences] -> ShowS
BatchEvaluateGeofences -> String
(Int -> BatchEvaluateGeofences -> ShowS)
-> (BatchEvaluateGeofences -> String)
-> ([BatchEvaluateGeofences] -> ShowS)
-> Show BatchEvaluateGeofences
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchEvaluateGeofences] -> ShowS
$cshowList :: [BatchEvaluateGeofences] -> ShowS
show :: BatchEvaluateGeofences -> String
$cshow :: BatchEvaluateGeofences -> String
showsPrec :: Int -> BatchEvaluateGeofences -> ShowS
$cshowsPrec :: Int -> BatchEvaluateGeofences -> ShowS
Prelude.Show, (forall x. BatchEvaluateGeofences -> Rep BatchEvaluateGeofences x)
-> (forall x.
Rep BatchEvaluateGeofences x -> BatchEvaluateGeofences)
-> Generic BatchEvaluateGeofences
forall x. Rep BatchEvaluateGeofences x -> BatchEvaluateGeofences
forall x. BatchEvaluateGeofences -> Rep BatchEvaluateGeofences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchEvaluateGeofences x -> BatchEvaluateGeofences
$cfrom :: forall x. BatchEvaluateGeofences -> Rep BatchEvaluateGeofences x
Prelude.Generic)
newBatchEvaluateGeofences ::
Prelude.Text ->
Prelude.NonEmpty DevicePositionUpdate ->
BatchEvaluateGeofences
newBatchEvaluateGeofences :: Text -> NonEmpty DevicePositionUpdate -> BatchEvaluateGeofences
newBatchEvaluateGeofences
Text
pCollectionName_
NonEmpty DevicePositionUpdate
pDevicePositionUpdates_ =
BatchEvaluateGeofences' :: Text -> NonEmpty DevicePositionUpdate -> BatchEvaluateGeofences
BatchEvaluateGeofences'
{ $sel:collectionName:BatchEvaluateGeofences' :: Text
collectionName =
Text
pCollectionName_,
$sel:devicePositionUpdates:BatchEvaluateGeofences' :: NonEmpty DevicePositionUpdate
devicePositionUpdates =
Tagged
(NonEmpty DevicePositionUpdate)
(Identity (NonEmpty DevicePositionUpdate))
-> Tagged
(NonEmpty DevicePositionUpdate)
(Identity (NonEmpty DevicePositionUpdate))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty DevicePositionUpdate)
(Identity (NonEmpty DevicePositionUpdate))
-> Tagged
(NonEmpty DevicePositionUpdate)
(Identity (NonEmpty DevicePositionUpdate)))
-> NonEmpty DevicePositionUpdate -> NonEmpty DevicePositionUpdate
forall t b. AReview t b -> b -> t
Lens.# NonEmpty DevicePositionUpdate
pDevicePositionUpdates_
}
batchEvaluateGeofences_collectionName :: Lens.Lens' BatchEvaluateGeofences Prelude.Text
batchEvaluateGeofences_collectionName :: (Text -> f Text)
-> BatchEvaluateGeofences -> f BatchEvaluateGeofences
batchEvaluateGeofences_collectionName = (BatchEvaluateGeofences -> Text)
-> (BatchEvaluateGeofences -> Text -> BatchEvaluateGeofences)
-> Lens BatchEvaluateGeofences BatchEvaluateGeofences Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEvaluateGeofences' {Text
collectionName :: Text
$sel:collectionName:BatchEvaluateGeofences' :: BatchEvaluateGeofences -> Text
collectionName} -> Text
collectionName) (\s :: BatchEvaluateGeofences
s@BatchEvaluateGeofences' {} Text
a -> BatchEvaluateGeofences
s {$sel:collectionName:BatchEvaluateGeofences' :: Text
collectionName = Text
a} :: BatchEvaluateGeofences)
batchEvaluateGeofences_devicePositionUpdates :: Lens.Lens' BatchEvaluateGeofences (Prelude.NonEmpty DevicePositionUpdate)
batchEvaluateGeofences_devicePositionUpdates :: (NonEmpty DevicePositionUpdate
-> f (NonEmpty DevicePositionUpdate))
-> BatchEvaluateGeofences -> f BatchEvaluateGeofences
batchEvaluateGeofences_devicePositionUpdates = (BatchEvaluateGeofences -> NonEmpty DevicePositionUpdate)
-> (BatchEvaluateGeofences
-> NonEmpty DevicePositionUpdate -> BatchEvaluateGeofences)
-> Lens
BatchEvaluateGeofences
BatchEvaluateGeofences
(NonEmpty DevicePositionUpdate)
(NonEmpty DevicePositionUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEvaluateGeofences' {NonEmpty DevicePositionUpdate
devicePositionUpdates :: NonEmpty DevicePositionUpdate
$sel:devicePositionUpdates:BatchEvaluateGeofences' :: BatchEvaluateGeofences -> NonEmpty DevicePositionUpdate
devicePositionUpdates} -> NonEmpty DevicePositionUpdate
devicePositionUpdates) (\s :: BatchEvaluateGeofences
s@BatchEvaluateGeofences' {} NonEmpty DevicePositionUpdate
a -> BatchEvaluateGeofences
s {$sel:devicePositionUpdates:BatchEvaluateGeofences' :: NonEmpty DevicePositionUpdate
devicePositionUpdates = NonEmpty DevicePositionUpdate
a} :: BatchEvaluateGeofences) ((NonEmpty DevicePositionUpdate
-> f (NonEmpty DevicePositionUpdate))
-> BatchEvaluateGeofences -> f BatchEvaluateGeofences)
-> ((NonEmpty DevicePositionUpdate
-> f (NonEmpty DevicePositionUpdate))
-> NonEmpty DevicePositionUpdate
-> f (NonEmpty DevicePositionUpdate))
-> (NonEmpty DevicePositionUpdate
-> f (NonEmpty DevicePositionUpdate))
-> BatchEvaluateGeofences
-> f BatchEvaluateGeofences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty DevicePositionUpdate
-> f (NonEmpty DevicePositionUpdate))
-> NonEmpty DevicePositionUpdate
-> f (NonEmpty DevicePositionUpdate)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchEvaluateGeofences where
type
AWSResponse BatchEvaluateGeofences =
BatchEvaluateGeofencesResponse
request :: BatchEvaluateGeofences -> Request BatchEvaluateGeofences
request = Service -> BatchEvaluateGeofences -> Request BatchEvaluateGeofences
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchEvaluateGeofences
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchEvaluateGeofences)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchEvaluateGeofences))
-> Logger
-> Service
-> Proxy BatchEvaluateGeofences
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchEvaluateGeofences)))
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 ->
Int
-> [BatchEvaluateGeofencesError] -> BatchEvaluateGeofencesResponse
BatchEvaluateGeofencesResponse'
(Int
-> [BatchEvaluateGeofencesError] -> BatchEvaluateGeofencesResponse)
-> Either String Int
-> Either
String
([BatchEvaluateGeofencesError] -> BatchEvaluateGeofencesResponse)
forall (f :: * -> *) a b. Functor 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
([BatchEvaluateGeofencesError] -> BatchEvaluateGeofencesResponse)
-> Either String [BatchEvaluateGeofencesError]
-> Either String BatchEvaluateGeofencesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe [BatchEvaluateGeofencesError])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Errors" Either String (Maybe [BatchEvaluateGeofencesError])
-> [BatchEvaluateGeofencesError]
-> Either String [BatchEvaluateGeofencesError]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [BatchEvaluateGeofencesError]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BatchEvaluateGeofences
instance Prelude.NFData BatchEvaluateGeofences
instance Core.ToHeaders BatchEvaluateGeofences where
toHeaders :: BatchEvaluateGeofences -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchEvaluateGeofences -> 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 BatchEvaluateGeofences where
toJSON :: BatchEvaluateGeofences -> Value
toJSON BatchEvaluateGeofences' {NonEmpty DevicePositionUpdate
Text
devicePositionUpdates :: NonEmpty DevicePositionUpdate
collectionName :: Text
$sel:devicePositionUpdates:BatchEvaluateGeofences' :: BatchEvaluateGeofences -> NonEmpty DevicePositionUpdate
$sel:collectionName:BatchEvaluateGeofences' :: BatchEvaluateGeofences -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"DevicePositionUpdates"
Text -> NonEmpty DevicePositionUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty DevicePositionUpdate
devicePositionUpdates
)
]
)
instance Core.ToPath BatchEvaluateGeofences where
toPath :: BatchEvaluateGeofences -> ByteString
toPath BatchEvaluateGeofences' {NonEmpty DevicePositionUpdate
Text
devicePositionUpdates :: NonEmpty DevicePositionUpdate
collectionName :: Text
$sel:devicePositionUpdates:BatchEvaluateGeofences' :: BatchEvaluateGeofences -> NonEmpty DevicePositionUpdate
$sel:collectionName:BatchEvaluateGeofences' :: BatchEvaluateGeofences -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/geofencing/v0/collections/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
collectionName,
ByteString
"/positions"
]
instance Core.ToQuery BatchEvaluateGeofences where
toQuery :: BatchEvaluateGeofences -> QueryString
toQuery = QueryString -> BatchEvaluateGeofences -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchEvaluateGeofencesResponse = BatchEvaluateGeofencesResponse'
{
BatchEvaluateGeofencesResponse -> Int
httpStatus :: Prelude.Int,
BatchEvaluateGeofencesResponse -> [BatchEvaluateGeofencesError]
errors :: [BatchEvaluateGeofencesError]
}
deriving (BatchEvaluateGeofencesResponse
-> BatchEvaluateGeofencesResponse -> Bool
(BatchEvaluateGeofencesResponse
-> BatchEvaluateGeofencesResponse -> Bool)
-> (BatchEvaluateGeofencesResponse
-> BatchEvaluateGeofencesResponse -> Bool)
-> Eq BatchEvaluateGeofencesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchEvaluateGeofencesResponse
-> BatchEvaluateGeofencesResponse -> Bool
$c/= :: BatchEvaluateGeofencesResponse
-> BatchEvaluateGeofencesResponse -> Bool
== :: BatchEvaluateGeofencesResponse
-> BatchEvaluateGeofencesResponse -> Bool
$c== :: BatchEvaluateGeofencesResponse
-> BatchEvaluateGeofencesResponse -> Bool
Prelude.Eq, ReadPrec [BatchEvaluateGeofencesResponse]
ReadPrec BatchEvaluateGeofencesResponse
Int -> ReadS BatchEvaluateGeofencesResponse
ReadS [BatchEvaluateGeofencesResponse]
(Int -> ReadS BatchEvaluateGeofencesResponse)
-> ReadS [BatchEvaluateGeofencesResponse]
-> ReadPrec BatchEvaluateGeofencesResponse
-> ReadPrec [BatchEvaluateGeofencesResponse]
-> Read BatchEvaluateGeofencesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchEvaluateGeofencesResponse]
$creadListPrec :: ReadPrec [BatchEvaluateGeofencesResponse]
readPrec :: ReadPrec BatchEvaluateGeofencesResponse
$creadPrec :: ReadPrec BatchEvaluateGeofencesResponse
readList :: ReadS [BatchEvaluateGeofencesResponse]
$creadList :: ReadS [BatchEvaluateGeofencesResponse]
readsPrec :: Int -> ReadS BatchEvaluateGeofencesResponse
$creadsPrec :: Int -> ReadS BatchEvaluateGeofencesResponse
Prelude.Read, Int -> BatchEvaluateGeofencesResponse -> ShowS
[BatchEvaluateGeofencesResponse] -> ShowS
BatchEvaluateGeofencesResponse -> String
(Int -> BatchEvaluateGeofencesResponse -> ShowS)
-> (BatchEvaluateGeofencesResponse -> String)
-> ([BatchEvaluateGeofencesResponse] -> ShowS)
-> Show BatchEvaluateGeofencesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchEvaluateGeofencesResponse] -> ShowS
$cshowList :: [BatchEvaluateGeofencesResponse] -> ShowS
show :: BatchEvaluateGeofencesResponse -> String
$cshow :: BatchEvaluateGeofencesResponse -> String
showsPrec :: Int -> BatchEvaluateGeofencesResponse -> ShowS
$cshowsPrec :: Int -> BatchEvaluateGeofencesResponse -> ShowS
Prelude.Show, (forall x.
BatchEvaluateGeofencesResponse
-> Rep BatchEvaluateGeofencesResponse x)
-> (forall x.
Rep BatchEvaluateGeofencesResponse x
-> BatchEvaluateGeofencesResponse)
-> Generic BatchEvaluateGeofencesResponse
forall x.
Rep BatchEvaluateGeofencesResponse x
-> BatchEvaluateGeofencesResponse
forall x.
BatchEvaluateGeofencesResponse
-> Rep BatchEvaluateGeofencesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchEvaluateGeofencesResponse x
-> BatchEvaluateGeofencesResponse
$cfrom :: forall x.
BatchEvaluateGeofencesResponse
-> Rep BatchEvaluateGeofencesResponse x
Prelude.Generic)
newBatchEvaluateGeofencesResponse ::
Prelude.Int ->
BatchEvaluateGeofencesResponse
newBatchEvaluateGeofencesResponse :: Int -> BatchEvaluateGeofencesResponse
newBatchEvaluateGeofencesResponse Int
pHttpStatus_ =
BatchEvaluateGeofencesResponse' :: Int
-> [BatchEvaluateGeofencesError] -> BatchEvaluateGeofencesResponse
BatchEvaluateGeofencesResponse'
{ $sel:httpStatus:BatchEvaluateGeofencesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:errors:BatchEvaluateGeofencesResponse' :: [BatchEvaluateGeofencesError]
errors = [BatchEvaluateGeofencesError]
forall a. Monoid a => a
Prelude.mempty
}
batchEvaluateGeofencesResponse_httpStatus :: Lens.Lens' BatchEvaluateGeofencesResponse Prelude.Int
batchEvaluateGeofencesResponse_httpStatus :: (Int -> f Int)
-> BatchEvaluateGeofencesResponse
-> f BatchEvaluateGeofencesResponse
batchEvaluateGeofencesResponse_httpStatus = (BatchEvaluateGeofencesResponse -> Int)
-> (BatchEvaluateGeofencesResponse
-> Int -> BatchEvaluateGeofencesResponse)
-> Lens
BatchEvaluateGeofencesResponse
BatchEvaluateGeofencesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEvaluateGeofencesResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchEvaluateGeofencesResponse' :: BatchEvaluateGeofencesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchEvaluateGeofencesResponse
s@BatchEvaluateGeofencesResponse' {} Int
a -> BatchEvaluateGeofencesResponse
s {$sel:httpStatus:BatchEvaluateGeofencesResponse' :: Int
httpStatus = Int
a} :: BatchEvaluateGeofencesResponse)
batchEvaluateGeofencesResponse_errors :: Lens.Lens' BatchEvaluateGeofencesResponse [BatchEvaluateGeofencesError]
batchEvaluateGeofencesResponse_errors :: ([BatchEvaluateGeofencesError] -> f [BatchEvaluateGeofencesError])
-> BatchEvaluateGeofencesResponse
-> f BatchEvaluateGeofencesResponse
batchEvaluateGeofencesResponse_errors = (BatchEvaluateGeofencesResponse -> [BatchEvaluateGeofencesError])
-> (BatchEvaluateGeofencesResponse
-> [BatchEvaluateGeofencesError] -> BatchEvaluateGeofencesResponse)
-> Lens
BatchEvaluateGeofencesResponse
BatchEvaluateGeofencesResponse
[BatchEvaluateGeofencesError]
[BatchEvaluateGeofencesError]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchEvaluateGeofencesResponse' {[BatchEvaluateGeofencesError]
errors :: [BatchEvaluateGeofencesError]
$sel:errors:BatchEvaluateGeofencesResponse' :: BatchEvaluateGeofencesResponse -> [BatchEvaluateGeofencesError]
errors} -> [BatchEvaluateGeofencesError]
errors) (\s :: BatchEvaluateGeofencesResponse
s@BatchEvaluateGeofencesResponse' {} [BatchEvaluateGeofencesError]
a -> BatchEvaluateGeofencesResponse
s {$sel:errors:BatchEvaluateGeofencesResponse' :: [BatchEvaluateGeofencesError]
errors = [BatchEvaluateGeofencesError]
a} :: BatchEvaluateGeofencesResponse) (([BatchEvaluateGeofencesError] -> f [BatchEvaluateGeofencesError])
-> BatchEvaluateGeofencesResponse
-> f BatchEvaluateGeofencesResponse)
-> (([BatchEvaluateGeofencesError]
-> f [BatchEvaluateGeofencesError])
-> [BatchEvaluateGeofencesError]
-> f [BatchEvaluateGeofencesError])
-> ([BatchEvaluateGeofencesError]
-> f [BatchEvaluateGeofencesError])
-> BatchEvaluateGeofencesResponse
-> f BatchEvaluateGeofencesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchEvaluateGeofencesError] -> f [BatchEvaluateGeofencesError])
-> [BatchEvaluateGeofencesError] -> f [BatchEvaluateGeofencesError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance
Prelude.NFData
BatchEvaluateGeofencesResponse