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