{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Location.Types.DevicePositionUpdate where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DevicePositionUpdate = DevicePositionUpdate'
{
DevicePositionUpdate -> Text
deviceId :: Prelude.Text,
DevicePositionUpdate -> Sensitive (NonEmpty Double)
position :: Core.Sensitive (Prelude.NonEmpty Prelude.Double),
DevicePositionUpdate -> POSIX
sampleTime :: Core.POSIX
}
deriving (DevicePositionUpdate -> DevicePositionUpdate -> Bool
(DevicePositionUpdate -> DevicePositionUpdate -> Bool)
-> (DevicePositionUpdate -> DevicePositionUpdate -> Bool)
-> Eq DevicePositionUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DevicePositionUpdate -> DevicePositionUpdate -> Bool
$c/= :: DevicePositionUpdate -> DevicePositionUpdate -> Bool
== :: DevicePositionUpdate -> DevicePositionUpdate -> Bool
$c== :: DevicePositionUpdate -> DevicePositionUpdate -> Bool
Prelude.Eq, Int -> DevicePositionUpdate -> ShowS
[DevicePositionUpdate] -> ShowS
DevicePositionUpdate -> String
(Int -> DevicePositionUpdate -> ShowS)
-> (DevicePositionUpdate -> String)
-> ([DevicePositionUpdate] -> ShowS)
-> Show DevicePositionUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DevicePositionUpdate] -> ShowS
$cshowList :: [DevicePositionUpdate] -> ShowS
show :: DevicePositionUpdate -> String
$cshow :: DevicePositionUpdate -> String
showsPrec :: Int -> DevicePositionUpdate -> ShowS
$cshowsPrec :: Int -> DevicePositionUpdate -> ShowS
Prelude.Show, (forall x. DevicePositionUpdate -> Rep DevicePositionUpdate x)
-> (forall x. Rep DevicePositionUpdate x -> DevicePositionUpdate)
-> Generic DevicePositionUpdate
forall x. Rep DevicePositionUpdate x -> DevicePositionUpdate
forall x. DevicePositionUpdate -> Rep DevicePositionUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DevicePositionUpdate x -> DevicePositionUpdate
$cfrom :: forall x. DevicePositionUpdate -> Rep DevicePositionUpdate x
Prelude.Generic)
newDevicePositionUpdate ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Double ->
Prelude.UTCTime ->
DevicePositionUpdate
newDevicePositionUpdate :: Text -> NonEmpty Double -> UTCTime -> DevicePositionUpdate
newDevicePositionUpdate
Text
pDeviceId_
NonEmpty Double
pPosition_
UTCTime
pSampleTime_ =
DevicePositionUpdate' :: Text
-> Sensitive (NonEmpty Double) -> POSIX -> DevicePositionUpdate
DevicePositionUpdate'
{ $sel:deviceId:DevicePositionUpdate' :: Text
deviceId = Text
pDeviceId_,
$sel:position:DevicePositionUpdate' :: Sensitive (NonEmpty Double)
position =
Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double)))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double))))
-> (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double)))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
(Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double))))
-> NonEmpty Double -> Sensitive (NonEmpty Double)
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pPosition_,
$sel:sampleTime:DevicePositionUpdate' :: POSIX
sampleTime = 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
pSampleTime_
}
devicePositionUpdate_deviceId :: Lens.Lens' DevicePositionUpdate Prelude.Text
devicePositionUpdate_deviceId :: (Text -> f Text) -> DevicePositionUpdate -> f DevicePositionUpdate
devicePositionUpdate_deviceId = (DevicePositionUpdate -> Text)
-> (DevicePositionUpdate -> Text -> DevicePositionUpdate)
-> Lens DevicePositionUpdate DevicePositionUpdate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePositionUpdate' {Text
deviceId :: Text
$sel:deviceId:DevicePositionUpdate' :: DevicePositionUpdate -> Text
deviceId} -> Text
deviceId) (\s :: DevicePositionUpdate
s@DevicePositionUpdate' {} Text
a -> DevicePositionUpdate
s {$sel:deviceId:DevicePositionUpdate' :: Text
deviceId = Text
a} :: DevicePositionUpdate)
devicePositionUpdate_position :: Lens.Lens' DevicePositionUpdate (Prelude.NonEmpty Prelude.Double)
devicePositionUpdate_position :: (NonEmpty Double -> f (NonEmpty Double))
-> DevicePositionUpdate -> f DevicePositionUpdate
devicePositionUpdate_position = (DevicePositionUpdate -> Sensitive (NonEmpty Double))
-> (DevicePositionUpdate
-> Sensitive (NonEmpty Double) -> DevicePositionUpdate)
-> Lens
DevicePositionUpdate
DevicePositionUpdate
(Sensitive (NonEmpty Double))
(Sensitive (NonEmpty Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePositionUpdate' {Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
$sel:position:DevicePositionUpdate' :: DevicePositionUpdate -> Sensitive (NonEmpty Double)
position} -> Sensitive (NonEmpty Double)
position) (\s :: DevicePositionUpdate
s@DevicePositionUpdate' {} Sensitive (NonEmpty Double)
a -> DevicePositionUpdate
s {$sel:position:DevicePositionUpdate' :: Sensitive (NonEmpty Double)
position = Sensitive (NonEmpty Double)
a} :: DevicePositionUpdate) ((Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> DevicePositionUpdate -> f DevicePositionUpdate)
-> ((NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> (NonEmpty Double -> f (NonEmpty Double))
-> DevicePositionUpdate
-> f DevicePositionUpdate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double))
forall a. Iso' (Sensitive a) a
Core._Sensitive ((NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> ((NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double))
-> (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double)
-> f (Sensitive (NonEmpty Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
devicePositionUpdate_sampleTime :: Lens.Lens' DevicePositionUpdate Prelude.UTCTime
devicePositionUpdate_sampleTime :: (UTCTime -> f UTCTime)
-> DevicePositionUpdate -> f DevicePositionUpdate
devicePositionUpdate_sampleTime = (DevicePositionUpdate -> POSIX)
-> (DevicePositionUpdate -> POSIX -> DevicePositionUpdate)
-> Lens DevicePositionUpdate DevicePositionUpdate POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePositionUpdate' {POSIX
sampleTime :: POSIX
$sel:sampleTime:DevicePositionUpdate' :: DevicePositionUpdate -> POSIX
sampleTime} -> POSIX
sampleTime) (\s :: DevicePositionUpdate
s@DevicePositionUpdate' {} POSIX
a -> DevicePositionUpdate
s {$sel:sampleTime:DevicePositionUpdate' :: POSIX
sampleTime = POSIX
a} :: DevicePositionUpdate) ((POSIX -> f POSIX)
-> DevicePositionUpdate -> f DevicePositionUpdate)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> DevicePositionUpdate
-> f DevicePositionUpdate
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.Hashable DevicePositionUpdate
instance Prelude.NFData DevicePositionUpdate
instance Core.ToJSON DevicePositionUpdate where
toJSON :: DevicePositionUpdate -> Value
toJSON DevicePositionUpdate' {Text
Sensitive (NonEmpty Double)
POSIX
sampleTime :: POSIX
position :: Sensitive (NonEmpty Double)
deviceId :: Text
$sel:sampleTime:DevicePositionUpdate' :: DevicePositionUpdate -> POSIX
$sel:position:DevicePositionUpdate' :: DevicePositionUpdate -> Sensitive (NonEmpty Double)
$sel:deviceId:DevicePositionUpdate' :: DevicePositionUpdate -> 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
"DeviceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Position" Text -> Sensitive (NonEmpty Double) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive (NonEmpty Double)
position),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SampleTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
sampleTime)
]
)