{-# 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.PutGeofence
(
PutGeofence (..),
newPutGeofence,
putGeofence_collectionName,
putGeofence_geofenceId,
putGeofence_geometry,
PutGeofenceResponse (..),
newPutGeofenceResponse,
putGeofenceResponse_httpStatus,
putGeofenceResponse_createTime,
putGeofenceResponse_geofenceId,
putGeofenceResponse_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 PutGeofence = PutGeofence'
{
PutGeofence -> Text
collectionName :: Prelude.Text,
PutGeofence -> Text
geofenceId :: Prelude.Text,
PutGeofence -> GeofenceGeometry
geometry :: GeofenceGeometry
}
deriving (PutGeofence -> PutGeofence -> Bool
(PutGeofence -> PutGeofence -> Bool)
-> (PutGeofence -> PutGeofence -> Bool) -> Eq PutGeofence
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutGeofence -> PutGeofence -> Bool
$c/= :: PutGeofence -> PutGeofence -> Bool
== :: PutGeofence -> PutGeofence -> Bool
$c== :: PutGeofence -> PutGeofence -> Bool
Prelude.Eq, Int -> PutGeofence -> ShowS
[PutGeofence] -> ShowS
PutGeofence -> String
(Int -> PutGeofence -> ShowS)
-> (PutGeofence -> String)
-> ([PutGeofence] -> ShowS)
-> Show PutGeofence
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutGeofence] -> ShowS
$cshowList :: [PutGeofence] -> ShowS
show :: PutGeofence -> String
$cshow :: PutGeofence -> String
showsPrec :: Int -> PutGeofence -> ShowS
$cshowsPrec :: Int -> PutGeofence -> ShowS
Prelude.Show, (forall x. PutGeofence -> Rep PutGeofence x)
-> (forall x. Rep PutGeofence x -> PutGeofence)
-> Generic PutGeofence
forall x. Rep PutGeofence x -> PutGeofence
forall x. PutGeofence -> Rep PutGeofence x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutGeofence x -> PutGeofence
$cfrom :: forall x. PutGeofence -> Rep PutGeofence x
Prelude.Generic)
newPutGeofence ::
Prelude.Text ->
Prelude.Text ->
GeofenceGeometry ->
PutGeofence
newPutGeofence :: Text -> Text -> GeofenceGeometry -> PutGeofence
newPutGeofence
Text
pCollectionName_
Text
pGeofenceId_
GeofenceGeometry
pGeometry_ =
PutGeofence' :: Text -> Text -> GeofenceGeometry -> PutGeofence
PutGeofence'
{ $sel:collectionName:PutGeofence' :: Text
collectionName = Text
pCollectionName_,
$sel:geofenceId:PutGeofence' :: Text
geofenceId = Text
pGeofenceId_,
$sel:geometry:PutGeofence' :: GeofenceGeometry
geometry = GeofenceGeometry
pGeometry_
}
putGeofence_collectionName :: Lens.Lens' PutGeofence Prelude.Text
putGeofence_collectionName :: (Text -> f Text) -> PutGeofence -> f PutGeofence
putGeofence_collectionName = (PutGeofence -> Text)
-> (PutGeofence -> Text -> PutGeofence)
-> Lens PutGeofence PutGeofence Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutGeofence' {Text
collectionName :: Text
$sel:collectionName:PutGeofence' :: PutGeofence -> Text
collectionName} -> Text
collectionName) (\s :: PutGeofence
s@PutGeofence' {} Text
a -> PutGeofence
s {$sel:collectionName:PutGeofence' :: Text
collectionName = Text
a} :: PutGeofence)
putGeofence_geofenceId :: Lens.Lens' PutGeofence Prelude.Text
putGeofence_geofenceId :: (Text -> f Text) -> PutGeofence -> f PutGeofence
putGeofence_geofenceId = (PutGeofence -> Text)
-> (PutGeofence -> Text -> PutGeofence)
-> Lens PutGeofence PutGeofence Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutGeofence' {Text
geofenceId :: Text
$sel:geofenceId:PutGeofence' :: PutGeofence -> Text
geofenceId} -> Text
geofenceId) (\s :: PutGeofence
s@PutGeofence' {} Text
a -> PutGeofence
s {$sel:geofenceId:PutGeofence' :: Text
geofenceId = Text
a} :: PutGeofence)
putGeofence_geometry :: Lens.Lens' PutGeofence GeofenceGeometry
putGeofence_geometry :: (GeofenceGeometry -> f GeofenceGeometry)
-> PutGeofence -> f PutGeofence
putGeofence_geometry = (PutGeofence -> GeofenceGeometry)
-> (PutGeofence -> GeofenceGeometry -> PutGeofence)
-> Lens PutGeofence PutGeofence GeofenceGeometry GeofenceGeometry
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutGeofence' {GeofenceGeometry
geometry :: GeofenceGeometry
$sel:geometry:PutGeofence' :: PutGeofence -> GeofenceGeometry
geometry} -> GeofenceGeometry
geometry) (\s :: PutGeofence
s@PutGeofence' {} GeofenceGeometry
a -> PutGeofence
s {$sel:geometry:PutGeofence' :: GeofenceGeometry
geometry = GeofenceGeometry
a} :: PutGeofence)
instance Core.AWSRequest PutGeofence where
type AWSResponse PutGeofence = PutGeofenceResponse
request :: PutGeofence -> Request PutGeofence
request = Service -> PutGeofence -> Request PutGeofence
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutGeofence
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutGeofence)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutGeofence))
-> Logger
-> Service
-> Proxy PutGeofence
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutGeofence)))
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 -> POSIX -> PutGeofenceResponse
PutGeofenceResponse'
(Int -> POSIX -> Text -> POSIX -> PutGeofenceResponse)
-> Either String Int
-> Either String (POSIX -> Text -> POSIX -> PutGeofenceResponse)
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 -> POSIX -> PutGeofenceResponse)
-> Either String POSIX
-> Either String (Text -> POSIX -> PutGeofenceResponse)
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 -> POSIX -> PutGeofenceResponse)
-> Either String Text
-> Either String (POSIX -> PutGeofenceResponse)
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 (POSIX -> PutGeofenceResponse)
-> Either String POSIX -> Either String PutGeofenceResponse
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 PutGeofence
instance Prelude.NFData PutGeofence
instance Core.ToHeaders PutGeofence where
toHeaders :: PutGeofence -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutGeofence -> 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 PutGeofence where
toJSON :: PutGeofence -> Value
toJSON PutGeofence' {Text
GeofenceGeometry
geometry :: GeofenceGeometry
geofenceId :: Text
collectionName :: Text
$sel:geometry:PutGeofence' :: PutGeofence -> GeofenceGeometry
$sel:geofenceId:PutGeofence' :: PutGeofence -> Text
$sel:collectionName:PutGeofence' :: PutGeofence -> 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
"Geometry" Text -> GeofenceGeometry -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= GeofenceGeometry
geometry)]
)
instance Core.ToPath PutGeofence where
toPath :: PutGeofence -> ByteString
toPath PutGeofence' {Text
GeofenceGeometry
geometry :: GeofenceGeometry
geofenceId :: Text
collectionName :: Text
$sel:geometry:PutGeofence' :: PutGeofence -> GeofenceGeometry
$sel:geofenceId:PutGeofence' :: PutGeofence -> Text
$sel:collectionName:PutGeofence' :: PutGeofence -> 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 PutGeofence where
toQuery :: PutGeofence -> QueryString
toQuery = QueryString -> PutGeofence -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutGeofenceResponse = PutGeofenceResponse'
{
PutGeofenceResponse -> Int
httpStatus :: Prelude.Int,
PutGeofenceResponse -> POSIX
createTime :: Core.POSIX,
PutGeofenceResponse -> Text
geofenceId :: Prelude.Text,
PutGeofenceResponse -> POSIX
updateTime :: Core.POSIX
}
deriving (PutGeofenceResponse -> PutGeofenceResponse -> Bool
(PutGeofenceResponse -> PutGeofenceResponse -> Bool)
-> (PutGeofenceResponse -> PutGeofenceResponse -> Bool)
-> Eq PutGeofenceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutGeofenceResponse -> PutGeofenceResponse -> Bool
$c/= :: PutGeofenceResponse -> PutGeofenceResponse -> Bool
== :: PutGeofenceResponse -> PutGeofenceResponse -> Bool
$c== :: PutGeofenceResponse -> PutGeofenceResponse -> Bool
Prelude.Eq, ReadPrec [PutGeofenceResponse]
ReadPrec PutGeofenceResponse
Int -> ReadS PutGeofenceResponse
ReadS [PutGeofenceResponse]
(Int -> ReadS PutGeofenceResponse)
-> ReadS [PutGeofenceResponse]
-> ReadPrec PutGeofenceResponse
-> ReadPrec [PutGeofenceResponse]
-> Read PutGeofenceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutGeofenceResponse]
$creadListPrec :: ReadPrec [PutGeofenceResponse]
readPrec :: ReadPrec PutGeofenceResponse
$creadPrec :: ReadPrec PutGeofenceResponse
readList :: ReadS [PutGeofenceResponse]
$creadList :: ReadS [PutGeofenceResponse]
readsPrec :: Int -> ReadS PutGeofenceResponse
$creadsPrec :: Int -> ReadS PutGeofenceResponse
Prelude.Read, Int -> PutGeofenceResponse -> ShowS
[PutGeofenceResponse] -> ShowS
PutGeofenceResponse -> String
(Int -> PutGeofenceResponse -> ShowS)
-> (PutGeofenceResponse -> String)
-> ([PutGeofenceResponse] -> ShowS)
-> Show PutGeofenceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutGeofenceResponse] -> ShowS
$cshowList :: [PutGeofenceResponse] -> ShowS
show :: PutGeofenceResponse -> String
$cshow :: PutGeofenceResponse -> String
showsPrec :: Int -> PutGeofenceResponse -> ShowS
$cshowsPrec :: Int -> PutGeofenceResponse -> ShowS
Prelude.Show, (forall x. PutGeofenceResponse -> Rep PutGeofenceResponse x)
-> (forall x. Rep PutGeofenceResponse x -> PutGeofenceResponse)
-> Generic PutGeofenceResponse
forall x. Rep PutGeofenceResponse x -> PutGeofenceResponse
forall x. PutGeofenceResponse -> Rep PutGeofenceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutGeofenceResponse x -> PutGeofenceResponse
$cfrom :: forall x. PutGeofenceResponse -> Rep PutGeofenceResponse x
Prelude.Generic)
newPutGeofenceResponse ::
Prelude.Int ->
Prelude.UTCTime ->
Prelude.Text ->
Prelude.UTCTime ->
PutGeofenceResponse
newPutGeofenceResponse :: Int -> UTCTime -> Text -> UTCTime -> PutGeofenceResponse
newPutGeofenceResponse
Int
pHttpStatus_
UTCTime
pCreateTime_
Text
pGeofenceId_
UTCTime
pUpdateTime_ =
PutGeofenceResponse' :: Int -> POSIX -> Text -> POSIX -> PutGeofenceResponse
PutGeofenceResponse'
{ $sel:httpStatus:PutGeofenceResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:createTime:PutGeofenceResponse' :: 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:PutGeofenceResponse' :: Text
geofenceId = Text
pGeofenceId_,
$sel:updateTime:PutGeofenceResponse' :: 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_
}
putGeofenceResponse_httpStatus :: Lens.Lens' PutGeofenceResponse Prelude.Int
putGeofenceResponse_httpStatus :: (Int -> f Int) -> PutGeofenceResponse -> f PutGeofenceResponse
putGeofenceResponse_httpStatus = (PutGeofenceResponse -> Int)
-> (PutGeofenceResponse -> Int -> PutGeofenceResponse)
-> Lens PutGeofenceResponse PutGeofenceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutGeofenceResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutGeofenceResponse' :: PutGeofenceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutGeofenceResponse
s@PutGeofenceResponse' {} Int
a -> PutGeofenceResponse
s {$sel:httpStatus:PutGeofenceResponse' :: Int
httpStatus = Int
a} :: PutGeofenceResponse)
putGeofenceResponse_createTime :: Lens.Lens' PutGeofenceResponse Prelude.UTCTime
putGeofenceResponse_createTime :: (UTCTime -> f UTCTime)
-> PutGeofenceResponse -> f PutGeofenceResponse
putGeofenceResponse_createTime = (PutGeofenceResponse -> POSIX)
-> (PutGeofenceResponse -> POSIX -> PutGeofenceResponse)
-> Lens PutGeofenceResponse PutGeofenceResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutGeofenceResponse' {POSIX
createTime :: POSIX
$sel:createTime:PutGeofenceResponse' :: PutGeofenceResponse -> POSIX
createTime} -> POSIX
createTime) (\s :: PutGeofenceResponse
s@PutGeofenceResponse' {} POSIX
a -> PutGeofenceResponse
s {$sel:createTime:PutGeofenceResponse' :: POSIX
createTime = POSIX
a} :: PutGeofenceResponse) ((POSIX -> f POSIX)
-> PutGeofenceResponse -> f PutGeofenceResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> PutGeofenceResponse
-> f PutGeofenceResponse
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
putGeofenceResponse_geofenceId :: Lens.Lens' PutGeofenceResponse Prelude.Text
putGeofenceResponse_geofenceId :: (Text -> f Text) -> PutGeofenceResponse -> f PutGeofenceResponse
putGeofenceResponse_geofenceId = (PutGeofenceResponse -> Text)
-> (PutGeofenceResponse -> Text -> PutGeofenceResponse)
-> Lens PutGeofenceResponse PutGeofenceResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutGeofenceResponse' {Text
geofenceId :: Text
$sel:geofenceId:PutGeofenceResponse' :: PutGeofenceResponse -> Text
geofenceId} -> Text
geofenceId) (\s :: PutGeofenceResponse
s@PutGeofenceResponse' {} Text
a -> PutGeofenceResponse
s {$sel:geofenceId:PutGeofenceResponse' :: Text
geofenceId = Text
a} :: PutGeofenceResponse)
putGeofenceResponse_updateTime :: Lens.Lens' PutGeofenceResponse Prelude.UTCTime
putGeofenceResponse_updateTime :: (UTCTime -> f UTCTime)
-> PutGeofenceResponse -> f PutGeofenceResponse
putGeofenceResponse_updateTime = (PutGeofenceResponse -> POSIX)
-> (PutGeofenceResponse -> POSIX -> PutGeofenceResponse)
-> Lens PutGeofenceResponse PutGeofenceResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutGeofenceResponse' {POSIX
updateTime :: POSIX
$sel:updateTime:PutGeofenceResponse' :: PutGeofenceResponse -> POSIX
updateTime} -> POSIX
updateTime) (\s :: PutGeofenceResponse
s@PutGeofenceResponse' {} POSIX
a -> PutGeofenceResponse
s {$sel:updateTime:PutGeofenceResponse' :: POSIX
updateTime = POSIX
a} :: PutGeofenceResponse) ((POSIX -> f POSIX)
-> PutGeofenceResponse -> f PutGeofenceResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> PutGeofenceResponse
-> f PutGeofenceResponse
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 PutGeofenceResponse