{-# 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.GetGeofence
(
GetGeofence (..),
newGetGeofence,
getGeofence_collectionName,
getGeofence_geofenceId,
GetGeofenceResponse (..),
newGetGeofenceResponse,
getGeofenceResponse_httpStatus,
getGeofenceResponse_createTime,
getGeofenceResponse_geofenceId,
getGeofenceResponse_geometry,
getGeofenceResponse_status,
getGeofenceResponse_updateTime,
)
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 GetGeofence = GetGeofence'
{
GetGeofence -> Text
collectionName :: Prelude.Text,
GetGeofence -> Text
geofenceId :: Prelude.Text
}
deriving (GetGeofence -> GetGeofence -> Bool
(GetGeofence -> GetGeofence -> Bool)
-> (GetGeofence -> GetGeofence -> Bool) -> Eq GetGeofence
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGeofence -> GetGeofence -> Bool
$c/= :: GetGeofence -> GetGeofence -> Bool
== :: GetGeofence -> GetGeofence -> Bool
$c== :: GetGeofence -> GetGeofence -> Bool
Prelude.Eq, ReadPrec [GetGeofence]
ReadPrec GetGeofence
Int -> ReadS GetGeofence
ReadS [GetGeofence]
(Int -> ReadS GetGeofence)
-> ReadS [GetGeofence]
-> ReadPrec GetGeofence
-> ReadPrec [GetGeofence]
-> Read GetGeofence
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGeofence]
$creadListPrec :: ReadPrec [GetGeofence]
readPrec :: ReadPrec GetGeofence
$creadPrec :: ReadPrec GetGeofence
readList :: ReadS [GetGeofence]
$creadList :: ReadS [GetGeofence]
readsPrec :: Int -> ReadS GetGeofence
$creadsPrec :: Int -> ReadS GetGeofence
Prelude.Read, Int -> GetGeofence -> ShowS
[GetGeofence] -> ShowS
GetGeofence -> String
(Int -> GetGeofence -> ShowS)
-> (GetGeofence -> String)
-> ([GetGeofence] -> ShowS)
-> Show GetGeofence
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGeofence] -> ShowS
$cshowList :: [GetGeofence] -> ShowS
show :: GetGeofence -> String
$cshow :: GetGeofence -> String
showsPrec :: Int -> GetGeofence -> ShowS
$cshowsPrec :: Int -> GetGeofence -> ShowS
Prelude.Show, (forall x. GetGeofence -> Rep GetGeofence x)
-> (forall x. Rep GetGeofence x -> GetGeofence)
-> Generic GetGeofence
forall x. Rep GetGeofence x -> GetGeofence
forall x. GetGeofence -> Rep GetGeofence x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGeofence x -> GetGeofence
$cfrom :: forall x. GetGeofence -> Rep GetGeofence x
Prelude.Generic)
newGetGeofence ::
Prelude.Text ->
Prelude.Text ->
GetGeofence
newGetGeofence :: Text -> Text -> GetGeofence
newGetGeofence Text
pCollectionName_ Text
pGeofenceId_ =
GetGeofence' :: Text -> Text -> GetGeofence
GetGeofence'
{ $sel:collectionName:GetGeofence' :: Text
collectionName = Text
pCollectionName_,
$sel:geofenceId:GetGeofence' :: Text
geofenceId = Text
pGeofenceId_
}
getGeofence_collectionName :: Lens.Lens' GetGeofence Prelude.Text
getGeofence_collectionName :: (Text -> f Text) -> GetGeofence -> f GetGeofence
getGeofence_collectionName = (GetGeofence -> Text)
-> (GetGeofence -> Text -> GetGeofence)
-> Lens GetGeofence GetGeofence Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeofence' {Text
collectionName :: Text
$sel:collectionName:GetGeofence' :: GetGeofence -> Text
collectionName} -> Text
collectionName) (\s :: GetGeofence
s@GetGeofence' {} Text
a -> GetGeofence
s {$sel:collectionName:GetGeofence' :: Text
collectionName = Text
a} :: GetGeofence)
getGeofence_geofenceId :: Lens.Lens' GetGeofence Prelude.Text
getGeofence_geofenceId :: (Text -> f Text) -> GetGeofence -> f GetGeofence
getGeofence_geofenceId = (GetGeofence -> Text)
-> (GetGeofence -> Text -> GetGeofence)
-> Lens GetGeofence GetGeofence Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeofence' {Text
geofenceId :: Text
$sel:geofenceId:GetGeofence' :: GetGeofence -> Text
geofenceId} -> Text
geofenceId) (\s :: GetGeofence
s@GetGeofence' {} Text
a -> GetGeofence
s {$sel:geofenceId:GetGeofence' :: Text
geofenceId = Text
a} :: GetGeofence)
instance Core.AWSRequest GetGeofence where
type AWSResponse GetGeofence = GetGeofenceResponse
request :: GetGeofence -> Request GetGeofence
request = Service -> GetGeofence -> Request GetGeofence
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetGeofence
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGeofence)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetGeofence))
-> Logger
-> Service
-> Proxy GetGeofence
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGeofence)))
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
-> POSIX
-> Text
-> GeofenceGeometry
-> Text
-> POSIX
-> GetGeofenceResponse
GetGeofenceResponse'
(Int
-> POSIX
-> Text
-> GeofenceGeometry
-> Text
-> POSIX
-> GetGeofenceResponse)
-> Either String Int
-> Either
String
(POSIX
-> Text
-> GeofenceGeometry
-> Text
-> POSIX
-> GetGeofenceResponse)
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
(POSIX
-> Text
-> GeofenceGeometry
-> Text
-> POSIX
-> GetGeofenceResponse)
-> Either String POSIX
-> Either
String
(Text -> GeofenceGeometry -> Text -> POSIX -> GetGeofenceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String POSIX
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"CreateTime")
Either
String
(Text -> GeofenceGeometry -> Text -> POSIX -> GetGeofenceResponse)
-> Either String Text
-> Either
String (GeofenceGeometry -> Text -> POSIX -> GetGeofenceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"GeofenceId")
Either
String (GeofenceGeometry -> Text -> POSIX -> GetGeofenceResponse)
-> Either String GeofenceGeometry
-> Either String (Text -> POSIX -> GetGeofenceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String GeofenceGeometry
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Geometry")
Either String (Text -> POSIX -> GetGeofenceResponse)
-> Either String Text
-> Either String (POSIX -> GetGeofenceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Status")
Either String (POSIX -> GetGeofenceResponse)
-> Either String POSIX -> Either String GetGeofenceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String POSIX
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"UpdateTime")
)
instance Prelude.Hashable GetGeofence
instance Prelude.NFData GetGeofence
instance Core.ToHeaders GetGeofence where
toHeaders :: GetGeofence -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetGeofence -> 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.ToPath GetGeofence where
toPath :: GetGeofence -> ByteString
toPath GetGeofence' {Text
geofenceId :: Text
collectionName :: Text
$sel:geofenceId:GetGeofence' :: GetGeofence -> Text
$sel:collectionName:GetGeofence' :: GetGeofence -> 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
"/geofences/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
geofenceId
]
instance Core.ToQuery GetGeofence where
toQuery :: GetGeofence -> QueryString
toQuery = QueryString -> GetGeofence -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetGeofenceResponse = GetGeofenceResponse'
{
GetGeofenceResponse -> Int
httpStatus :: Prelude.Int,
GetGeofenceResponse -> POSIX
createTime :: Core.POSIX,
GetGeofenceResponse -> Text
geofenceId :: Prelude.Text,
GetGeofenceResponse -> GeofenceGeometry
geometry :: GeofenceGeometry,
GetGeofenceResponse -> Text
status :: Prelude.Text,
GetGeofenceResponse -> POSIX
updateTime :: Core.POSIX
}
deriving (GetGeofenceResponse -> GetGeofenceResponse -> Bool
(GetGeofenceResponse -> GetGeofenceResponse -> Bool)
-> (GetGeofenceResponse -> GetGeofenceResponse -> Bool)
-> Eq GetGeofenceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGeofenceResponse -> GetGeofenceResponse -> Bool
$c/= :: GetGeofenceResponse -> GetGeofenceResponse -> Bool
== :: GetGeofenceResponse -> GetGeofenceResponse -> Bool
$c== :: GetGeofenceResponse -> GetGeofenceResponse -> Bool
Prelude.Eq, Int -> GetGeofenceResponse -> ShowS
[GetGeofenceResponse] -> ShowS
GetGeofenceResponse -> String
(Int -> GetGeofenceResponse -> ShowS)
-> (GetGeofenceResponse -> String)
-> ([GetGeofenceResponse] -> ShowS)
-> Show GetGeofenceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGeofenceResponse] -> ShowS
$cshowList :: [GetGeofenceResponse] -> ShowS
show :: GetGeofenceResponse -> String
$cshow :: GetGeofenceResponse -> String
showsPrec :: Int -> GetGeofenceResponse -> ShowS
$cshowsPrec :: Int -> GetGeofenceResponse -> ShowS
Prelude.Show, (forall x. GetGeofenceResponse -> Rep GetGeofenceResponse x)
-> (forall x. Rep GetGeofenceResponse x -> GetGeofenceResponse)
-> Generic GetGeofenceResponse
forall x. Rep GetGeofenceResponse x -> GetGeofenceResponse
forall x. GetGeofenceResponse -> Rep GetGeofenceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGeofenceResponse x -> GetGeofenceResponse
$cfrom :: forall x. GetGeofenceResponse -> Rep GetGeofenceResponse x
Prelude.Generic)
newGetGeofenceResponse ::
Prelude.Int ->
Prelude.UTCTime ->
Prelude.Text ->
GeofenceGeometry ->
Prelude.Text ->
Prelude.UTCTime ->
GetGeofenceResponse
newGetGeofenceResponse :: Int
-> UTCTime
-> Text
-> GeofenceGeometry
-> Text
-> UTCTime
-> GetGeofenceResponse
newGetGeofenceResponse
Int
pHttpStatus_
UTCTime
pCreateTime_
Text
pGeofenceId_
GeofenceGeometry
pGeometry_
Text
pStatus_
UTCTime
pUpdateTime_ =
GetGeofenceResponse' :: Int
-> POSIX
-> Text
-> GeofenceGeometry
-> Text
-> POSIX
-> GetGeofenceResponse
GetGeofenceResponse'
{ $sel:httpStatus:GetGeofenceResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:createTime:GetGeofenceResponse' :: POSIX
createTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateTime_,
$sel:geofenceId:GetGeofenceResponse' :: Text
geofenceId = Text
pGeofenceId_,
$sel:geometry:GetGeofenceResponse' :: GeofenceGeometry
geometry = GeofenceGeometry
pGeometry_,
$sel:status:GetGeofenceResponse' :: Text
status = Text
pStatus_,
$sel:updateTime:GetGeofenceResponse' :: POSIX
updateTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdateTime_
}
getGeofenceResponse_httpStatus :: Lens.Lens' GetGeofenceResponse Prelude.Int
getGeofenceResponse_httpStatus :: (Int -> f Int) -> GetGeofenceResponse -> f GetGeofenceResponse
getGeofenceResponse_httpStatus = (GetGeofenceResponse -> Int)
-> (GetGeofenceResponse -> Int -> GetGeofenceResponse)
-> Lens GetGeofenceResponse GetGeofenceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeofenceResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGeofenceResponse' :: GetGeofenceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGeofenceResponse
s@GetGeofenceResponse' {} Int
a -> GetGeofenceResponse
s {$sel:httpStatus:GetGeofenceResponse' :: Int
httpStatus = Int
a} :: GetGeofenceResponse)
getGeofenceResponse_createTime :: Lens.Lens' GetGeofenceResponse Prelude.UTCTime
getGeofenceResponse_createTime :: (UTCTime -> f UTCTime)
-> GetGeofenceResponse -> f GetGeofenceResponse
getGeofenceResponse_createTime = (GetGeofenceResponse -> POSIX)
-> (GetGeofenceResponse -> POSIX -> GetGeofenceResponse)
-> Lens GetGeofenceResponse GetGeofenceResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeofenceResponse' {POSIX
createTime :: POSIX
$sel:createTime:GetGeofenceResponse' :: GetGeofenceResponse -> POSIX
createTime} -> POSIX
createTime) (\s :: GetGeofenceResponse
s@GetGeofenceResponse' {} POSIX
a -> GetGeofenceResponse
s {$sel:createTime:GetGeofenceResponse' :: POSIX
createTime = POSIX
a} :: GetGeofenceResponse) ((POSIX -> f POSIX)
-> GetGeofenceResponse -> f GetGeofenceResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetGeofenceResponse
-> f GetGeofenceResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
getGeofenceResponse_geofenceId :: Lens.Lens' GetGeofenceResponse Prelude.Text
getGeofenceResponse_geofenceId :: (Text -> f Text) -> GetGeofenceResponse -> f GetGeofenceResponse
getGeofenceResponse_geofenceId = (GetGeofenceResponse -> Text)
-> (GetGeofenceResponse -> Text -> GetGeofenceResponse)
-> Lens GetGeofenceResponse GetGeofenceResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeofenceResponse' {Text
geofenceId :: Text
$sel:geofenceId:GetGeofenceResponse' :: GetGeofenceResponse -> Text
geofenceId} -> Text
geofenceId) (\s :: GetGeofenceResponse
s@GetGeofenceResponse' {} Text
a -> GetGeofenceResponse
s {$sel:geofenceId:GetGeofenceResponse' :: Text
geofenceId = Text
a} :: GetGeofenceResponse)
getGeofenceResponse_geometry :: Lens.Lens' GetGeofenceResponse GeofenceGeometry
getGeofenceResponse_geometry :: (GeofenceGeometry -> f GeofenceGeometry)
-> GetGeofenceResponse -> f GetGeofenceResponse
getGeofenceResponse_geometry = (GetGeofenceResponse -> GeofenceGeometry)
-> (GetGeofenceResponse -> GeofenceGeometry -> GetGeofenceResponse)
-> Lens
GetGeofenceResponse
GetGeofenceResponse
GeofenceGeometry
GeofenceGeometry
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeofenceResponse' {GeofenceGeometry
geometry :: GeofenceGeometry
$sel:geometry:GetGeofenceResponse' :: GetGeofenceResponse -> GeofenceGeometry
geometry} -> GeofenceGeometry
geometry) (\s :: GetGeofenceResponse
s@GetGeofenceResponse' {} GeofenceGeometry
a -> GetGeofenceResponse
s {$sel:geometry:GetGeofenceResponse' :: GeofenceGeometry
geometry = GeofenceGeometry
a} :: GetGeofenceResponse)
getGeofenceResponse_status :: Lens.Lens' GetGeofenceResponse Prelude.Text
getGeofenceResponse_status :: (Text -> f Text) -> GetGeofenceResponse -> f GetGeofenceResponse
getGeofenceResponse_status = (GetGeofenceResponse -> Text)
-> (GetGeofenceResponse -> Text -> GetGeofenceResponse)
-> Lens GetGeofenceResponse GetGeofenceResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeofenceResponse' {Text
status :: Text
$sel:status:GetGeofenceResponse' :: GetGeofenceResponse -> Text
status} -> Text
status) (\s :: GetGeofenceResponse
s@GetGeofenceResponse' {} Text
a -> GetGeofenceResponse
s {$sel:status:GetGeofenceResponse' :: Text
status = Text
a} :: GetGeofenceResponse)
getGeofenceResponse_updateTime :: Lens.Lens' GetGeofenceResponse Prelude.UTCTime
getGeofenceResponse_updateTime :: (UTCTime -> f UTCTime)
-> GetGeofenceResponse -> f GetGeofenceResponse
getGeofenceResponse_updateTime = (GetGeofenceResponse -> POSIX)
-> (GetGeofenceResponse -> POSIX -> GetGeofenceResponse)
-> Lens GetGeofenceResponse GetGeofenceResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeofenceResponse' {POSIX
updateTime :: POSIX
$sel:updateTime:GetGeofenceResponse' :: GetGeofenceResponse -> POSIX
updateTime} -> POSIX
updateTime) (\s :: GetGeofenceResponse
s@GetGeofenceResponse' {} POSIX
a -> GetGeofenceResponse
s {$sel:updateTime:GetGeofenceResponse' :: POSIX
updateTime = POSIX
a} :: GetGeofenceResponse) ((POSIX -> f POSIX)
-> GetGeofenceResponse -> f GetGeofenceResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GetGeofenceResponse
-> f GetGeofenceResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Prelude.NFData GetGeofenceResponse