{-# 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.IoT.Types.LocationTimestamp where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data LocationTimestamp = LocationTimestamp'
{
LocationTimestamp -> Maybe Text
unit :: Prelude.Maybe Prelude.Text,
LocationTimestamp -> Text
value :: Prelude.Text
}
deriving (LocationTimestamp -> LocationTimestamp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LocationTimestamp -> LocationTimestamp -> Bool
$c/= :: LocationTimestamp -> LocationTimestamp -> Bool
== :: LocationTimestamp -> LocationTimestamp -> Bool
$c== :: LocationTimestamp -> LocationTimestamp -> Bool
Prelude.Eq, ReadPrec [LocationTimestamp]
ReadPrec LocationTimestamp
Int -> ReadS LocationTimestamp
ReadS [LocationTimestamp]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LocationTimestamp]
$creadListPrec :: ReadPrec [LocationTimestamp]
readPrec :: ReadPrec LocationTimestamp
$creadPrec :: ReadPrec LocationTimestamp
readList :: ReadS [LocationTimestamp]
$creadList :: ReadS [LocationTimestamp]
readsPrec :: Int -> ReadS LocationTimestamp
$creadsPrec :: Int -> ReadS LocationTimestamp
Prelude.Read, Int -> LocationTimestamp -> ShowS
[LocationTimestamp] -> ShowS
LocationTimestamp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LocationTimestamp] -> ShowS
$cshowList :: [LocationTimestamp] -> ShowS
show :: LocationTimestamp -> String
$cshow :: LocationTimestamp -> String
showsPrec :: Int -> LocationTimestamp -> ShowS
$cshowsPrec :: Int -> LocationTimestamp -> ShowS
Prelude.Show, forall x. Rep LocationTimestamp x -> LocationTimestamp
forall x. LocationTimestamp -> Rep LocationTimestamp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LocationTimestamp x -> LocationTimestamp
$cfrom :: forall x. LocationTimestamp -> Rep LocationTimestamp x
Prelude.Generic)
newLocationTimestamp ::
Prelude.Text ->
LocationTimestamp
newLocationTimestamp :: Text -> LocationTimestamp
newLocationTimestamp Text
pValue_ =
LocationTimestamp'
{ $sel:unit:LocationTimestamp' :: Maybe Text
unit = forall a. Maybe a
Prelude.Nothing,
$sel:value:LocationTimestamp' :: Text
value = Text
pValue_
}
locationTimestamp_unit :: Lens.Lens' LocationTimestamp (Prelude.Maybe Prelude.Text)
locationTimestamp_unit :: Lens' LocationTimestamp (Maybe Text)
locationTimestamp_unit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocationTimestamp' {Maybe Text
unit :: Maybe Text
$sel:unit:LocationTimestamp' :: LocationTimestamp -> Maybe Text
unit} -> Maybe Text
unit) (\s :: LocationTimestamp
s@LocationTimestamp' {} Maybe Text
a -> LocationTimestamp
s {$sel:unit:LocationTimestamp' :: Maybe Text
unit = Maybe Text
a} :: LocationTimestamp)
locationTimestamp_value :: Lens.Lens' LocationTimestamp Prelude.Text
locationTimestamp_value :: Lens' LocationTimestamp Text
locationTimestamp_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocationTimestamp' {Text
value :: Text
$sel:value:LocationTimestamp' :: LocationTimestamp -> Text
value} -> Text
value) (\s :: LocationTimestamp
s@LocationTimestamp' {} Text
a -> LocationTimestamp
s {$sel:value:LocationTimestamp' :: Text
value = Text
a} :: LocationTimestamp)
instance Data.FromJSON LocationTimestamp where
parseJSON :: Value -> Parser LocationTimestamp
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LocationTimestamp"
( \Object
x ->
Maybe Text -> Text -> LocationTimestamp
LocationTimestamp'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"unit")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"value")
)
instance Prelude.Hashable LocationTimestamp where
hashWithSalt :: Int -> LocationTimestamp -> Int
hashWithSalt Int
_salt LocationTimestamp' {Maybe Text
Text
value :: Text
unit :: Maybe Text
$sel:value:LocationTimestamp' :: LocationTimestamp -> Text
$sel:unit:LocationTimestamp' :: LocationTimestamp -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
unit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value
instance Prelude.NFData LocationTimestamp where
rnf :: LocationTimestamp -> ()
rnf LocationTimestamp' {Maybe Text
Text
value :: Text
unit :: Maybe Text
$sel:value:LocationTimestamp' :: LocationTimestamp -> Text
$sel:unit:LocationTimestamp' :: LocationTimestamp -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
unit seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value
instance Data.ToJSON LocationTimestamp where
toJSON :: LocationTimestamp -> Value
toJSON LocationTimestamp' {Maybe Text
Text
value :: Text
unit :: Maybe Text
$sel:value:LocationTimestamp' :: LocationTimestamp -> Text
$sel:unit:LocationTimestamp' :: LocationTimestamp -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"unit" 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
unit,
forall a. a -> Maybe a
Prelude.Just (Key
"value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)
]
)