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